forked from jcubic/lips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (80 loc) · 3.07 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
.PHONY: publish test coveralls lint zero
VERSION=1.0.0-beta.10
VERSION_DASH=`echo -n "1.0.0-beta.10" | sed "s/-/%E2%80%93/"`
BRANCH=`git branch | grep '^*' | sed 's/* //'`
DATE=`date -uR`
YEAR=`date +%Y`
DATE_SHORT=`date +%Y-%m-%d`
TESTS_CHECKSUM=`cat tests/test.js tests/*.scm | md5sum | cut -d' ' -f 1`
COMMIT=`git rev-parse HEAD`
URL=`git config --get remote.origin.url`
UNICODE=https://unicode.org/Public/UNIDATA/UnicodeData.txt
MAKE=make
GIT=git
CD=cd
SED=sed
CP=cp
RM=rm
TEST=test
CAT=cat
NPM=npm
NODE=node
WGET=wget
ESLINT=./node_modules/.bin/eslint
COVERALLS=./node_modules/.bin/coveralls
JEST=./node_modules/.bin/jest
NPM=npm
UGLIFY=./node_modules/.bin/uglifyjs
ROLLUP=./node_modules/.bin/rollup
ALL: Makefile package.json .$(VERSION) dist/lips.js dist/lips.min.js README.md
dist/lips.js: src/lips.js .$(VERSION) rollup.config.js
$(ROLLUP) -c
$(SED) -i '/^\s*\/\*\*/,/^\s*\*\//d' dist/lips.js
$(CAT) src/banner.js dist/lips.js > dist/tmp.js
$(CP) dist/tmp.js dist/lips.js
$(RM) dist/tmp.js
$(GIT) branch | grep '* devel' > /dev/null && $(SED) -i -e "s/{{VER}}/DEV/g" -e "s/{{DATE}}/$(DATE)/g" \
dist/lips.js || $(SED) -i -e "s/{{VER}}/$(VERSION)/g" -e "s/{{DATE}}/$(DATE)/g" -e "s/{{YEAR}}/${YEAR}/" \
dist/lips.js
dist/lips.min.js: dist/lips.js .$(VERSION)
$(UGLIFY) -o dist/lips.min.js --comments --mangle -- dist/lips.js
Makefile: templates/Makefile
$(SED) -e "s/{{VER""SION}}/"$(VERSION)"/g" templates/Makefile > Makefile
package.json: templates/package.json .$(VERSION)
$(SED) -e "s/{{VER}}/"$(VERSION)"/g" templates/package.json > package.json || true
README.md: templates/README.md dist/lips.js .$(VERSION)
$(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{{VER}}/DEV/g" -e \
"s/{{VER_DASH}}/$(VERSION_DASH)/g" -e "s/{{BRANCH}}/$(BRANCH)/g" -e "s/{{CHECKSUM}}/$(TESTS_CHECKSUM)/g" \
-e "s/{{YEAR}}/${YEAR}/g" -e "s/{{DATE}}/${DATE_SHORT}/" -e "s/{{COMMIT}}/$(COMMIT)/g" \
< templates/README.md > README.md || \
$(SED) -e "s/{{VER}}/$(VERSION)/g" -e "s/{{BRANCH}}/$(BRANCH)/g" -e "s/{{YEAR}}/${YEAR}/g" \
-e "s/{{CHECKSUM}}/$(TESTS_CHECKSUM)/g" -e "s/{{COMMIT}}/$(COMMIT)/g" -e "s/{{DATE}}/${DATE_SHORT}/" \
-e "s/{{VER_DASH}}/$(VERSION_DASH)/g" < templates/README.md > README.md
.$(VERSION): Makefile
touch .$(VERSION)
publish-beta:
$(GIT) clone $(URL) --depth 1 npm
$(CD) npm && $(NPM) publish --access=public --tag beta
$(RM) -rf npm
publish:
$(GIT) clone $(URL) --depth 1 npm
$(CD) npm && $(NPM) publish --access=public
$(RM) -rf npm
jest-test: dist/lips.js
@$(JEST) --coverage spec/*.spec.js
test: dist/lips.js
@$(NPM) run test
zero:
@$(WGET) $(UNICODE) -O ./assets/UnicodeData.txt
unicode: assets/UnicodeData.txt
@$(NODE) ./scripts/numerals.js
watch-test:
@inotifywait -m -e close_write src/lips.js tests/*.scm | while read even; do $(MAKE) --no-print-directory test; done
watch-lint:
@inotifywait -m -e close_write src/lips.js | while read even; do $(MAKE) --no-print-directory lint; done
watch-make:
@inotifywait -m -e close_write src/lips.js | while read even; do $(MAKE) --no-print-directory; done
coveralls:
$(NPM) run coverage
lint:
$(ESLINT) src/lips.js