forked from riot/compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (49 loc) · 1.73 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
# jspreproc flags
JSPP_FLAGS = -F istanbul -F eslint --custom-filter "\s@(module|version)\b" --headers ""
JSPP_NODE_FLAGS = $(JSPP_FLAGS) -D NODE -F jsdoc
JSPP_RIOT_FLAGS = $(JSPP_FLAGS)
JSPP_ES6_FLAGS = $(JSPP_FLAGS)
NODE_VER := $(shell node nodever)
# Command line paths
COVERALLS = ./node_modules/coveralls/bin/coveralls.js
ESLINT = ./node_modules/eslint/bin/eslint.js
ISTANBUL = ./node_modules/istanbul/lib/cli.js
MOCHA = ./node_modules/mocha/bin/_mocha
JSPP = ./node_modules/jspreproc/bin/jspp.js
# folders
DIST = "./dist/"
LIB = "./lib/"
# default job
test: build test-mocha
build: clean pre-build eslint
# build riot and es6 versions
@ mkdir -p $(DIST)
@ $(JSPP) $(JSPP_RIOT_FLAGS) src/_riot.js > $(DIST)riot.compiler.js
@ $(JSPP) $(JSPP_ES6_FLAGS) src/_es6.js > $(DIST)es6.compiler.js
clean:
@ rm -rf $(DIST)
pre-build:
# build the node version
@ $(JSPP) $(JSPP_NODE_FLAGS) src/core.js > $(LIB)compiler.js
@ $(JSPP) $(JSPP_NODE_FLAGS) src/safe-regex.js > $(LIB)safe-regex.js
@ $(JSPP) $(JSPP_NODE_FLAGS) src/js-splitter.js > $(LIB)js-splitter.js
eslint:
# check code style
ifneq ($(NODE_VER),0.12)
@ $(ESLINT) -c ./.eslintrc.yml src test
@ $(ESLINT) -c ./.eslintrc.yml lib \
--ignore-pattern "**/compiler.js" --ignore-pattern "**/safe-regex.js"
endif
test-mocha:
@ $(ISTANBUL) cover $(MOCHA) -- test/runner.js
send-coverage:
@ RIOT_COV=1 cat ./coverage/lcov.info | $(COVERALLS)
debug: build
# launching node-inspector
@ node-debug $(MOCHA) test/runner.js
perf: build
@ node --expose-gc test/perf.js
docs:
# You need "npm i -g jsdoc && npm i minami" to this work
@ jsdoc $(LIB) --configure ./jsdoc.json -P ./package.json --verbose
.PHONY: test pre-build build eslint test-mocha send-coverage debug perf docs