-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
66 lines (53 loc) · 1.49 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
LIBRARY=jroff
SHELL=/bin/bash
CORE_FILES=src/jroff.js src/core/{token,token_factory,lexer,parser}.js
MACROS=src/macros/*.js
GENERATORS=src/generators/*.js
SOURCE_FILES=src/utils/preamble.js ${CORE_FILES} ${MACROS} ${GENERATORS} src/utils/postamble.js
DIST=dist/${LIBRARY}.js
DIST_MIN=dist/${LIBRARY}.min.js
TEST=test/
COLOR=\033[0;33m
NO_COLOR=\033[0m
DATE=$(date +'%y.%m.%d %H:%M:%S')
all: build test
dist: beautify hint test min
build:
$(notify_task)
awk 'FNR==1{print ""}1' ${SOURCE_FILES} > ${DIST}
min:
$(notify_task)
node_modules/uglify-js/bin/uglifyjs \
--comments "/\*\* [a-z]/i" -m < ${DIST} > ${DIST_MIN}
wc ${DIST}
gzip -9 < ${DIST} | wc
gzip -9 < ${DIST_MIN} | wc
hint: build beautify
$(notify_task)
node_modules/.bin/eslint ${DIST}
node_modules/.bin/eslint ${TEST}
beautify:
$(notify_task)
find {src,test,dist} -type f -name "*.js" ! -name '*.min.js'\
-exec node_modules/.bin/js-beautify -r --good-stuff {} \;
test:
$(notify_task)
node_modules/.bin/istanbul cover \
node_modules/.bin/_mocha test/test.js -- -R dot
doc: build beautify
$(notify_task)
node_modules/.bin/jsdoc --verbose -d docs -t node_modules/minami ${DIST}
doc-build: doc
$(notify_task)
git checkout gh-pages
rm -rf ./{fonts,scripts,styles} && mv -f docs/* .
git commit -a -m "Update documentation - ${DATE}"
git push origin gh-pages
git checkout master
bench: build
$(notify_task)
node benchmarks/benchmark.js $(flags)
.PHONY: test
define notify_task
@echo -e "${COLOR}\n*** $@ ***\n${NO_COLOR}"
endef