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
130 lines (96 loc) · 2.78 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
DOCS := docs/*.md
REPORTER ?= spec
PROCESSOR ?= "/opt/v8/tools/linux-tick-processor"
LIB := ./node_modules
BIN := $(LIB)/.bin
all: build
# Main tasks
# ----------
build:
@$(BIN)/grunt build
lint:
@$(BIN)/grunt lint
# 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/
# Usage: make VERSION=0.1.0 version-bump
version-bump:
@sed -i 's|\("version": "\)[^"]*\("\)|\1$(VERSION)\2|' bower.json package.json
@sed -i "s|\(exports\.version = '\)[^']*\('\)|\1$(VERSION)\2|" luaparse.js
@git add package.json bower.json luaparse.js
@git commit -m "Version $(VERSION)"
@git tag "v$(VERSION)"
# Tests
# -----
test:
@node test/runner.js --console
testem:
@testem
testem-modern:
@testem -l bs_ie_9.0,bs_ie_10.0,bs_chrome_27.0,bs_ff_20.0,bs_safari_6.0,bs_opera_12.14
testem-legacy:
@testem -l bs_ie_6.0,bs_ie_7.0,bs_ie_8.0,bs_opera_10.0,bs_safari_4.0
# 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
# Documentation
# -------------
docs: docco coverage docs-test docs-md
docco:
@$(BIN)/doccoh luaparse.js
docs-test:
@$(MAKE) -s test REPORTER=doc \
| cat docs/layout/head.html - docs/layout/foot.html \
> docs/tests.html
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 \
> $@
# Coverage
# --------
coverage:
@rm -rf html-report docs/coverage
@$(BIN)/istanbul cover --report html --dir docs/coverage test/runner.js >/dev/null
# 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
# Quality Assurance
# -----------------
complexity-analysis:
@echo "===================== Complexity analysis ============================"
@./scripts/complexity 10
@node $(LIB)/complexity-report/src/cli.js \
-lws --maxcc 15 \
luaparse.js
coverage-analysis: coverage
@$(BIN)/istanbul check-coverage --statements -7 --branches -11 --functions -1 \
docs/coverage/coverage.json
qa:
@$(MAKE) -s test 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