This repository has been archived by the owner on Jun 15, 2019. It is now read-only.
forked from zaach/ebnf-parser
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
81 lines (47 loc) · 1.41 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
JISON_VERSION := $(shell node ../../dist/cli-cjs-es5.js -V 2> /dev/null )
ifndef JISON_VERSION
JISON = sh node_modules/.bin/jison
else
JISON = node ../../dist/cli-cjs-es5.js
endif
ROLLUP = node_modules/.bin/rollup
BABEL = node_modules/.bin/babel
MOCHA = node_modules/.bin/mocha
all: build test
prep: npm-install
npm-install:
npm install
npm-update:
ncu -a --packageFile=package.json
build:
ifeq ($(wildcard ./node_modules/.bin/jison),)
$(error "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###")
endif
node __patch_version_in_js.js
$(JISON) -m es bnf.y bnf.l
mv bnf.js parser.js
$(JISON) -m es ebnf.y
mv ebnf.js transform-parser.js
node __patch_prelude_in_js.js
-mkdir -p dist
$(ROLLUP) -c
$(BABEL) dist/ebnf-parser-cjs.js -o dist/ebnf-parser-cjs-es5.js
$(BABEL) dist/ebnf-parser-umd.js -o dist/ebnf-parser-umd-es5.js
test:
$(MOCHA) --timeout 18000 --check-leaks --globals assert tests/
# increment the XXX <prelease> number in the package.json file: version <major>.<minor>.<patch>-<prelease>
bump:
git-tag:
publish:
npm run pub
clean:
-rm -f parser.js
-rm -f transform-parser.js
-rm -f bnf.js
-rm -f ebnf.js
-rm -rf dist/
-rm -rf node_modules/
-rm -f package-lock.json
superclean: clean
-find . -type d -name 'node_modules' -exec rm -rf "{}" \;
.PHONY: all prep npm-install build test clean superclean bump git-tag publish npm-update