This repository has been archived by the owner on Jun 26, 2023. It is now read-only.
forked from CMGStudios/luaparse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
140 lines (104 loc) · 3.04 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
REPORTER?=spec
DOCS=docs/*.md
HTMLDOCS=$(DOCS:.md=.html)
HASH=$(shell git rev-parse HEAD | cut -c1-5)
all: build
# Main tasks
# ----------
build:
@./node_modules/.bin/grunt build
lint:
@./node_modules/.bin/grunt lint
# Install and internal updates
# ----------------------------
install:
@npm install
install-test:
@cp ./node_modules/mocha/mocha.js test/lib/mocha/
@cp ./node_modules/mocha/mocha.css test/lib/mocha/
@cp ./node_modules/expect.js/expect.js test/lib/
@cp ./node_modules/benchmark/benchmark.js test/lib/
update-browserscope:
@sed -i "s/\(window\.commit = '\)[^']*\(';\)/\1$(HASH)\2/" test/benchmarks.html
version-bump:
@sed -i 's/\("version": "\)[^"]*\("\)/\1$(VERSION)\2/' package.json component.json
# Tests
# -----
test: test-spec
test-spec:
@./node_modules/.bin/mocha \
--reporter $(REPORTER) \
test/spec/*
test-all: test-spec
# Scaffold all test files in the scaffolding dir.
scaffold-tests:
@$(foreach file,\
$(notdir $(wildcard test/scaffolding/*)),\
$(MAKE) -s scaffold-test FILE=$(file);\
)
scaffold-test:
@./scripts/make-test --name=$(FILE) \
test/scaffolding/$(FILE) \
> test/spec/$(FILE).js
# Documentation
# -------------
docs: docco coverage docs-test docs-md
docco:
@./node_modules/.bin/doccoh lib/*.js
docs-test:
@$(MAKE) -s test REPORTER=doc \
| cat docs/layout/head.html - docs/layout/foot.html \
> docs/tests.html
docs-index:
@./node_modules/.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 $<
@./node_modules/.bin/marked $< --gfm \
| cat docs/layout/head.html - docs/layout/foot.html \
> $@
# Coverage
# --------
coverage: coverage-instrument
@rm -rf html-report docs/coverage
@ISTANBUL_REPORTERS=html,text-summary COVERAGE=1 \
$(MAKE) -s test REPORTER=mocha-istanbul
@mv html-report docs/coverage
coverage-cover:
@ISTANBUL_REPORTERS=text-summary,json COVERAGE=1 \
$(MAKE) -s test REPORTER=mocha-istanbul
coverage-instrument:
@rm -rf lib-cov
@./node_modules/.bin/istanbul instrument \
--output lib-cov --no-compact --variable global.__coverage__ \
lib
# Benchmark
# ---------
benchmark:
@./scripts/benchmark -v benchmarks/lib/ParseLua.lua
profile:
@bash benchmarks/run.sh -v --d8 HEAD
benchmark-full:
@bash benchmarks/run.sh -v --js --lua --esprima HEAD
# Quality Assurance
# -----------------
complexity-analysis:
@echo "===================== Complexity analysis ============================"
@./scripts/complexity 10
@node ./node_modules/complexity-report/src/cli.js \
-lws --maxcc 15 \
lib/luaparse.js
coverage-analysis: coverage-instrument coverage-cover
@node ./node_modules/istanbul/lib/cli.js check-coverage \
--statements -7 --branches -11 --functions -1 \
coverage.json
@rm -f coverage.json
qa:
@$(MAKE) -s test-spec REPORTER=dot
@$(MAKE) -s lint complexity-analysis coverage-analysis
clean:
@rm -f docs/*.html docs/*.1
@rm -rf lib-cov coverage html-report docs/coverage/
.PHONY: test test-md coverage test-all docs