-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathMakefile
123 lines (86 loc) · 2.37 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
115
116
117
118
119
120
121
122
123
DOCS := docs/*.md
PROCESSOR ?= "/opt/v8/tools/linux-tick-processor"
LIB := ./node_modules
BIN := $(LIB)/.bin
all: build
# Main tasks
# ----------
build:
$(BIN)/gulp build
lint:
$(BIN)/gulp lint
.PHONY: build lint all
# Install and internal updates
# ----------------------------
install:
npm install
# This is required if mocha, expect or benchmark is updated.
update:
cp -v $(LIB)/spec/lib/* test/lib/
cp -v $(LIB)/benchmark/benchmark.js test/lib/
version-bump:
$(BIN)/gulp version-bump
git add luaparse.js
.PHONY: install update version-bump
# Tests
# -----
test-node:
node test/runner.js --console
test:
$(BIN)/testem ci
testem-engines:
$(BIN)/testem -l node,ringo,rhino,rhino1.7R5
# Scaffold all test files in the scaffolding dir.
scaffold-tests:
$(foreach file,\
$(notdir $(wildcard test/scaffolding/*)),\
$(MAKE) scaffold-test FILE=$(file);\
)
scaffold-test:
./scripts/scaffold-test --name=$(FILE) \
test/scaffolding/$(FILE) \
> test/spec/$(FILE).js
.PHONY: test-node test testem-engines scaffold-tests scaffold-test
# Documentation
# -------------
docs: coverage docs-test docs-md
docs-index:
$(BIN)/marked README.md --gfm \
| cat docs/layout/head.html - docs/layout/foot.html \
> docs/index.html
docs-md: docs-index $(patsubst %.md,%.html, $(wildcard docs/*.md))
%.html: %.md
echo $<
$(BIN)/marked $< --gfm \
| cat docs/layout/head.html - docs/layout/foot.html \
> $@
.PHONY: docs docs-test docs-index
# Coverage
# --------
coverage:
rm -rf html-report docs/coverage
$(BIN)/nyc --reporter=html --report-dir=docs/coverage node test/runner.js --console >/dev/null
.PHONY: coverage
# Benchmark
# ---------
benchmark:
./scripts/benchmark -v benchmarks/lib/ParseLua.lua
profile:
bash benchmarks/run.sh -v --processor $(PROCESSOR) --profile HEAD
benchmark-previous:
bash benchmarks/run.sh --js HEAD HEAD~1
.PHONY: benchmark profile benchmark-previous
# Quality Assurance
# -----------------
complexity-analysis:
@echo "===================== Complexity analysis ============================"
./scripts/complexity 10
$(BIN)/cr -lws --maxcc 22 luaparse.js
coverage-analysis: coverage
$(BIN)/nyc check-coverage --statements 100 --branches 100 --functions 100
qa:
$(MAKE) test lint complexity-analysis coverage-analysis
clean:
rm -f docs/*.html
rm -rf lib-cov coverage html-report docs/coverage/
.PHONY: complexity-analysis coverage-analysis qa clean