-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
78 lines (53 loc) · 1.75 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
# Defining shell is necessary in order to modify PATH
SHELL := sh
export PATH := node_modules/.bin/:$(PATH)
export NODE_OPTIONS := --trace-deprecation
# Modify these variables in local.mk to add flags to the commands, ie.
# MOCHA_FLAGS += --reporter nyan
# Now mocha will be invoked with the extra flag and will show a nice nyan cat as progress bar 🎉
MOCHA_FLAGS :=
BABEL_FLAGS :=
ESLINT_FLAGS :=
NPM_FLAGS :=
SRCFILES := $(patsubst %.mjs, %.js, $(shell utils/make/projectfiles.sh mjs))
GITFILES := $(patsubst utils/githooks/%, .git/hooks/%, $(wildcard utils/githooks/*))
# Do this when make is invoked without targets
all: precompile $(GITFILES)
# GENERIC TARGETS
node_modules: package.json
npm install $(NPM_FLAGS) && touch node_modules
# Default compilation target for all source files
%.js: %.mjs node_modules babel.config.js
babel $< --out-file $@ $(BABEL_FLAGS)
# Default target for all possible git hooks
.git/hooks/%: utils/githooks/%
cp $< $@
coverage/lcov.info: $(SRCFILES)
nyc mocha $(MOCHA_FLAGS)
# TASK DEFINITIONS
compile: $(SRCFILES)
coverage: coverage/lcov.info
precompile: install
babel . --extensions .mjs --out-dir . $(BABEL_FLAGS)
install: node_modules $(GITFILES)
lint: force install
eslint --cache --ext .mjs --report-unused-disable-directives $(ESLINT_FLAGS) .
remark --quiet .
test: force compile
mocha $(MOCHA_FLAGS)
inspect: force compile
mocha --inspect --inspect-brk $(MOCHA_FLAGS)
watch: force compile
mocha --reporter min $(MOCHA_FLAGS) --watch
unlock: pristine
rm -f package-lock.json
touch package.json
clean:
rm -rf {.nyc_output,coverage,docs}
find . -name '*.log' -print -delete
distclean: clean
rm -f $(shell ./utils/make/projectfiles.sh js)
pristine: distclean
rm -rf node_modules
.PHONY: force
-include local.mk