forked from commonmark/commonmark.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (33 loc) · 1.24 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
SPEC=test/spec.txt
SPECVERSION=$(shell perl -ne 'print $$1 if /^version: *([0-9.]+)/' $(SPEC))
BENCHINP?=bench/samples/README.md
JSMODULES=$(wildcard lib/*.js)
VERSION?=$(SPECVERSION)
ESLINT=node_modules/.bin/eslint
UGLIFYJS=node_modules/.bin/uglifyjs
BROWSERIFY=node_modules/.bin/browserify
.PHONY: dingus dist test bench bench-detailed npm lint clean update-spec
lint:
$(ESLINT) -c eslint.json ${JSMODULES} bin/commonmark test/test.js dingus/dingus.js
dist: dist/commonmark.js dist/commonmark.min.js
dist/commonmark.js: lib/index.js ${JSMODULES}
echo '/* commonmark $(VERSION) https://github.com/CommonMark/commonmark.js @license BSD3 */' > $@
$(BROWSERIFY) --standalone commonmark $< >> $@
dist/commonmark.min.js: dist/commonmark.js
$(UGLIFYJS) --version # version should be at least 2.5.0
$(UGLIFYJS) $< --compress keep_fargs=true,pure_getters=true --comments > $@
update-spec:
curl 'https://raw.githubusercontent.com/jgm/CommonMark/master/spec.txt' > $(SPEC)
test: $(SPEC)
node test/test.js
bench:
node bench/bench.js ${BENCHINP}
bench-detailed:
sudo renice -10 $$$$; \
for x in bench/samples/*.md; do echo $$x; node bench/bench.js $$x; done | \
awk -f bench/format_benchmarks.awk
npm:
cd js; npm publish
dingus:
make -C dingus dingus
clean: