-
Notifications
You must be signed in to change notification settings - Fork 179
/
Makefile
114 lines (88 loc) · 2.89 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# opentrons protocol designer makefile
# using bash instead of /bin/bash in SHELL prevents macOS optimizing away our PATH update
SHELL := bash
# add node_modules/.bin to PATH
PATH := $(shell cd .. && yarn bin):$(PATH)
benchmark_output := $(shell node -e 'console.log(new Date());')
# These variables can be overriden when make is invoked to customize the
# behavior of jest
tests ?=
cov_opts ?= --coverage=true
test_opts ?=
# standard targets
#####################################################################
.PHONY: all
all: clean build
.PHONY: setup
setup:
yarn
.PHONY: clean
clean:
shx rm -rf dist
# artifacts
#####################################################################
.PHONY: build
build: export NODE_ENV := production
build:
vite build
git rev-parse HEAD > dist/.commit
# development
#####################################################################
.PHONY: benchmarks
benchmarks: export NODE_ENV := test
benchmarks:
shx mkdir -p benchmarks/output
node ../scripts/runBenchmarks "./benchmarks/*.js" | \
ntee "./benchmarks/output/$(benchmark_output)"
.PHONY: dev
dev: export NODE_ENV := development
dev:
vite serve
# production assets server
.PHONY: serve
serve: all
node ../scripts/serve-static dist
# end to end tests
.PHONY: test-e2e
test-e2e: clean-downloads
concurrently --no-color --kill-others --success first --names "protocol-designer-server,protocol-designer-tests" \
"$(MAKE) dev" \
"wait-on http://localhost:5178/ && cypress run --browser chrome --headless --record false"
.PHONY: test
test:
$(MAKE) -C .. test-js-protocol-designer tests="$(tests)" test_opts="$(test_opts)"
.PHONY: test-cov
test-cov:
make -C .. test-js-protocol-designer tests=$(tests) test_opts="$(test_opts)" cov_opts="$(cov_opts)"
CYPRESS_ESLINT_GLOB := "cypress/**/*.{js,ts,tsx}"
CYPRESS_PRETTIER_GLOB := "cypress/**/*.{js,ts,tsx,md,json}"
.PHONY: cy-lint-check
cy-lint-check: cy-lint-eslint-check cy-lint-prettier-check
@echo "Cypress lint check completed."
.PHONY: cy-lint-fix
cy-lint-fix: cy-lint-eslint-fix cy-lint-prettier-fix
@echo "Cypress lint fix applied."
.PHONY: cy-lint-eslint-check
cy-lint-eslint-check:
yarn eslint --ignore-path ../.eslintignore $(CYPRESS_ESLINT_GLOB)
@echo "Cypress ESLint check completed."
.PHONY: cy-lint-eslint-fix
cy-lint-eslint-fix:
yarn eslint --fix --ignore-pattern ../.eslintignore $(CYPRESS_ESLINT_GLOB)
@echo "Cypress ESLint fix applied."
.PHONY: cy-lint-prettier-check
cy-lint-prettier-check:
yarn prettier --ignore-path ../.eslintignore --check $(CYPRESS_PRETTIER_GLOB)
@echo "Cypress Prettier check completed."
.PHONY: cy-lint-prettier-fix
cy-lint-prettier-fix:
yarn prettier --ignore-path ../.eslintignore --write $(CYPRESS_PRETTIER_GLOB)
@echo "Cypress Prettier fix applied."
.PHONY: cy-ui
cy-ui:
@echo "Running Cypress UI"
@echo "Dev environment must be running"
yarn cypress open
.PHONY: clean-downloads
clean-downloads:
shx rm -rf cypress/downloads