Files
cellxgene/client/Makefile
Severiano Badajoz e5dfd6e8fa Add eslint steps to lint job (#1335)
* add lint-client and lint-diff-client targets

* add lint-diff and lint targets

* prettier

* add lint-diff call to lint task

* temp

* tweak lint-diff

* add lint for PRs and lint for master

* remove temp

* remove incorrect branches syntax, use github_ref

* pull all branches

* format

* proper target and comment

* create separate steps with conditionals

* fix indentation

* refactor lint->lint-server, introduce lint to lint all

* trade diff-index for diff, do check against base instead of master

* remove fetching all branches

* Revert "remove fetching all branches"

This reverts commit 26ce7a0f05.

* tweak comparison

* use local eslint

* add eslint  dep install

* temp

* grab only base

* simplify fetch

* add pull_request type trigger

* specify pushes only to master

* change conditionals to be based on event name

* Revert "temp"

This reverts commit 3d59134cc0.

* "branch" => "branches"

* create separate installation step

* change command based on os
2020-04-15 09:41:45 -07:00

111 lines
2.7 KiB
Makefile

include ../common.mk
# https://stackoverflow.com/a/14777895/9587410
ifeq ($(shell uname),Darwin) # is Windows_NT on XP, 2000, 7, Vista, 10...
IS_DARWIN := "true"
endif
DATASET := $(if $(DATASET),$(DATASET),../example-dataset/pbmc3k.h5ad)
ANNOTATIONS := $(if $(ANNOTATIONS),$(ANNOTATIONS),../server/test/test_datasets/pbmc3k-annotations.csv)
ANNOTATIONS_FILENAME := $(shell basename $(ANNOTATIONS))
# Packaging
.PHONY: clean
clean:
rm -rf node_modules
.PHONY: ci
ci:
npm ci
.PHONY: install
install:
npm install
.PHONY: build
build:
npm run build
# Formatting code
.PHONY: lint
lint:
npx eslint .
.PHONY: lint-diff
lint-diff:
# Get client diff against master, find all js/jsx files, remove the client prefex, run eslinst against result
git diff --name-only --diff-filter=d origin/master...HEAD -- ../client/ | grep -E "(.*)\.(jsx|js)" | sed "s/client\///" | $(if $(IS_DARWIN),xargs ./node_modules/.bin/eslint,xargs -r ./node_modules/.bin/eslint)
# Development convenience methods
.PHONY: server-requirements
server-requirements:
virtualenv -p python3 ../venv
source ../venv/bin/activate && \
pip install -r ../server/requirements-dev.txt && \
yes | pip uninstall cellxgene || true && \
pip install -e ..
.PHONY: start-frontend
start-frontend:
node server/development.js
.PHONY: start-server
start-server:
cellxgene launch -p $(CXG_SERVER_PORT) $(CXG_OPTIONS) $(DATASET)
.PHONY: backend-dev
backend-dev: server-requirements
source ../venv/bin/activate && CXG_OPTIONS='--debug' $(MAKE) start-server
.PHONY: backend-dev-anno-ontology
backend-dev-anno-ontology: server-requirements
CXG_OPTIONS='--experimental-annotations-ontology --debug' \
$(MAKE) backend-dev
.PHONY: test
test:
node node_modules/jest/bin/jest.js
.PHONY: e2e
e2e:
node node_modules/jest/bin/jest.js \
--verbose false \
--config __tests__/e2e/e2eJestConfig.json \
e2e/e2e.test.js
.PHONY: e2e-annotations
e2e-annotations:
node node_modules/jest/bin/jest.js \
--verbose false \
--config __tests__/e2e/e2eJestConfig.json \
e2e/e2eAnnotations.test.js
.PHONY: smoke-test
smoke-test:
start_server_and_test \
'CXG_OPTIONS="--disable-annotations" $(MAKE) start-server' \
$(CXG_SERVER_PORT) \
'$(MAKE) e2e'
.PHONY: smoke-test-annotations
smoke-test-annotations:
$(eval TMP_DIR := $(shell mktemp -d /tmp/cellxgene_XXXXXX))
cp $(ANNOTATIONS) $(TMP_DIR)/ && \
start_server_and_test \
'CXG_OPTIONS="--annotations-file $(TMP_DIR)/$(ANNOTATIONS_FILENAME)" $(MAKE) start-server' \
$(CXG_SERVER_PORT) \
'$(MAKE) e2e-annotations'
rm -rf $(TMP_DIR)
.PHONY: unit-test
unit-test:
node node_modules/jest/bin/jest.js \
--testPathIgnorePatterns e2e
# pass remaining commands through to npm run
%:
npm run $(*)