forked from hotoo/pinyin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
86 lines (63 loc) · 1.92 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
version = $(shell cat package.json | grep version | awk -F'"' '{print $$4}')
install:
@spm install
@npm install
build:
@spm build
publish: publish-doc
@npm publish
@git tag $(version)
@git push origin $(version)
build-doc: clean build
@spm doc build
watch:
@spm doc watch
publish-doc: clean build-doc
@ghp-import _site
@git push origin gh-pages
clean:
@rm -fr _site
runner = _site/tests/runner.html
benchmark:
@node tests/benchmark.test.js
test-cli:
@mocha -R spec --timeout 5000 tests/cli.test.js
test-npm:
@./node_modules/.bin/istanbul cover \
./node_modules/.bin/_mocha \
-- \
--harmony \
--reporter spec \
--timeout 2000 \
--inline-diffs \
./tests/test.js
test-spm:
@spm test
lint:
@./node_modules/eslint/bin/eslint.js ./lib/ ./bin/ ./tests/
test: lint test-npm test-cli benchmark
output = _site/coverage.html
coverage: build-doc
@rm -fr _site/src-cov
@jscoverage --encoding=utf8 src _site/src-cov
@mocha-browser ${runner}?cov -S -R html-cov > ${output}
@echo "Build coverage to ${output}"
ZI_DICT_FREQUENT = ./tools/dict/zi-frequent.js
ZI_DICT_INFREQUENT = ./tools/dict/zi-infrequent.js
ZI_DICT= ./tools/dict/dict-zi.js
ZI_DICT_WEB= ./tools/dict/dict-zi-web.js
dict-web:
@echo 'module.exports = {' > $(ZI_DICT_FREQUENT)
@node ./tools/robot-frequent.js >> $(ZI_DICT_FREQUENT)
@echo '};' >> $(ZI_DICT_FREQUENT)
@echo 'module.exports = {' > $(ZI_DICT_INFREQUENT)
@node ./tools/robot-infrequent.js >> $(ZI_DICT_INFREQUENT)
@echo '};' >> $(ZI_DICT_INFREQUENT)
@node ./tools/combo-dict.js > $(ZI_DICT_WEB)
dict-node:
@echo 'var dict = [];' > $(ZI_DICT)
@node ./tools/robot-zdic-zi.js >> $(ZI_DICT)
@echo 'module.exports = dict;' >> $(ZI_DICT)
infrequent:
@node ./tools/infrequent.js > ./tools/zi/infrequent.js
.PHONY: build-doc publish-doc server clean test coverage test-spm test-npm test-cli lint benchmark