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
132 lines (94 loc) · 2.77 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
DOCS := docs/*.md
PROCESSOR ?= "/opt/v8/tools/linux-tick-processor"
LIB := ./node_modules
BIN := $(LIB)/.bin
all: build
# Main tasks
# ----------
build:
gulp build
lint:
gulp lint
.PHONY: build lint all
# Install and internal updates
# ----------------------------
install:
@npm install
@bower 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/
# Usage: make VERSION=0.1.0 version-bump
version-bump:
@sed -i 's|\("version": "\)[^"]*\("\)|\1$(VERSION)\2|' {bower,package,component}.json
@sed -i "s|\(exports\.version = '\)[^']*\('\)|\1$(VERSION)\2|" luaparse.js
@git add {package,bower,component}.json luaparse.js
@git commit -m "Version $(VERSION)"
@git tag -a "v$(VERSION)" -m "v$(VERSION)"
.PHONY: install update version-bump
# Tests
# -----
test-node:
@node test/runner.js --console
test:
@$(BIN)/testem ci
testem-engines:
@$(BIN)/testem -l PhantomJS,node,narwhal,ringo,rhino,rhino1.7R5
# 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/scaffold-test --name=$(FILE) \
test/scaffolding/$(FILE) \
> test/spec/$(FILE).js
.PHONY: test-node test testem-engines scaffold-tests scaffold-test
# Documentation
# -------------
docs: docco coverage docs-test docs-md
docco:
@$(BIN)/docco luaparse.js
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 docco docs-test docs-index
# Coverage
# --------
coverage:
@rm -rf html-report docs/coverage
@$(BIN)/istanbul cover --report html --dir docs/coverage test/runner.js >/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 17 luaparse.js
coverage-analysis: coverage
@$(BIN)/istanbul check-coverage --statements -6 --branches -16 --functions -0 \
docs/coverage/coverage.json
qa:
@$(MAKE) -s 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