forked from msoftware/jquery.liveaddress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (31 loc) · 1.55 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
#!/usr/bin/make -f
VERSION := $(shell tagit -p --dry-run)
VERSION_FILE1 := package.json
VERSION_FILE2 := package-lock.json
VERSION_FILE3 := liveaddress.jquery.json
VERSION_FILE4 := src/liveAddressPlugin.js
clean:
rm -rf workspace
compile: node_modules
node_modules:
npm install
publish: clean compile version upload unversion
upload:
mkdir -p workspace \
&& npx browserify src/jquery.liveaddress.js | gzip -9 > workspace/jquery.liveaddress.js \
&& npx browserify src/jquery.liveaddress.js -p [tinyify --no-flat] | gzip -9 > workspace/jquery.liveaddress.min.js \
&& npm publish \
&& (cd resources && python publish.py "$(VERSION)")
version:
sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE1)" && rm -f "$(VERSION_FILE1).bak"
sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE2)" && rm -f "$(VERSION_FILE2).bak"
sed -i.bak -e 's/^ "version": "0\.0\.0",/ "version": "$(VERSION)",/g' "$(VERSION_FILE3)" && rm -f "$(VERSION_FILE3).bak"
sed -i.bak -e 's/^\tvar version \= "0.0.0";/\tvar version \= "$(VERSION)";/g' "$(VERSION_FILE4)" && rm -f "$(VERSION_FILE4).bak"
unversion:
git checkout "$(VERSION_FILE1)" "$(VERSION_FILE2)" "$(VERSION_FILE3)" "$(VERSION_FILE4)"
rm -f "$(VERSION_FILE1).bak" "$(VERSION_FILE2).bak" "$(VERSION_FILE3).bak" "$(VERSION_FILE4).bak"
##########################################################
release: publish
tagit -p && git push origin --tags
# node_modules is a real directory target
.PHONY: clean compile publish upload version unversion release