-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
71 lines (54 loc) · 1.33 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
NODE_VERSION := v16
GIT_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NODE_ROOT := $(GIT_ROOT)/node_modules
NODE_BIN := $(NODE_ROOT)/.bin
typescript := $(NODE_BIN)/tsc
eslint := $(NODE_BIN)/eslint
prettier := $(NODE_BIN)/prettier
ncc := $(NODE_BIN)/ncc
jest := $(NODE_BIN)/jest
default: $(NODE_ROOT) release
ifeq ($(shell node -v),$(NODE_VERSION))
$(NODE_ROOT) $(NODE_BIN):
npm install
else
$(NODE_ROOT) $(NODE_BIN):
@echo "\033[1;33mWARNING: This project is tested with node $(NODE_VERSION).\033[0m"
@echo "\033[1;33mWARNING: Your node version is $(shell node -v) instead.\033[0m"
npm install
endif
install $(typescript) $(eslint) $(prettier) $(ncc) $(jest): | $(NODE_BIN)
npm install
watch: format | $(typescript)
npm run watch
dist/index.js: | $(NODE_BIN) lib/pyenv-action.js
npm run release
lib/pyenv-action.js: | $(typescript)
npm run build
release: clean test dist/index.js
build: format | $(NODE_BIN)
npm run build
format: | $(prettier)
npm run format
lint: | $(eslint)
npm run lint
test: | $(jest)
npm run test
test-watch: | $(jest)
npm run test-watch
clean:
rm -f dist/index.js
node-check: $(NODE_BIN) $(NODE_ROOT)
@echo BIN $(NODE_BIN)
@echo ROOT $(NODE_ROOT)
.PHONY: \
build \
clean \
default \
format \
install \
lint \
node-check \
release \
test \
watch