-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.node
80 lines (61 loc) · 1.69 KB
/
Makefile.node
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
.PHONY: node
node: clear node-dump node-test node-lint ok
dump: node-dump
clean: node-clean
build: node-build
dev: node-dev
dependencies: node-dependencies
test: node-test
lint: node-lint
export PATH := $(ROOT)/node_modules/.bin:$(PATH)
NODE_ROOT = src/
NODE_TMP = $(TMP)/node
NODE_DEPENDENCY_MARK = node_modules/.dependencies
.PHONY: node-dump
node-dump:
node --version
npm --version
.PHONY: node-clean
node-clean:
rm -fr "$(NODE_TMP)"
.PHONY: node-dependencies
node-dependencies: $(NODE_DEPENDENCY_MARK)
$(NODE_DEPENDENCY_MARK): package-lock.json
npm ci
touch package-lock.json
#Also done in package.json
touch "$@"
package-lock.json: package.json
npm install --package-lock-only
@touch "$@"
node-build: dist/main.js
dist/main.js: $(shell find $(NODE_ROOT)) \
$(wildcard $(NODE_ROOT)/**/*.js) \
node-dependencies
./node_modules/.bin/webpack
.PHONY: node-dev
node-dev: $(shell find $(NODE_ROOT)) \
$(wildcard $(NODE_ROOT)/**/*.js) \
node-dependencies
./node_modules/.bin/webpack --watch
.PHONY: node-lint
node-lint: node-lint-typescript node-lint-eslint
.PHONY: node-lint-typescript
node-lint-typescript: $(NODE_DEPENDENCY_MARK)
node_modules/.bin/tsc --noEmit
.PHONY: node-lint-eslint
node-lint-eslint: $(NODE_DEPENDENCY_MARK)
eslint --ext js,ts .
.PHONY: eslint-fix
node-eslint-fix: $(NODE_DEPENDENCY_MARK)
eslint --ext js,mjs . --fix
.PHONY: node-test
node-test: $(NODE_DEPENDENCY_MARK)
rm -fr "$(NODE_TMP)"
mkdir -p "$(NODE_TMP)"
# Check reporters: https://nodejs.org/api/test.html#test-reporters
# --experimental-test-coverage
node --import tsx/esm --harmony-temporal $(ARGS) --test "$(NODE_ROOT)/**/*.spec.ts"
.PHONY: node-test-watch
node-test-watch:
ARGS="--watch" make node-test