-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
45 lines (36 loc) · 1.01 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
o = out
nodeBin = node_modules/.bin
shipFiles = \
app.js \
index.html \
todomvc-common/base.css \
todomvc-common/base.js \
todomvc-app-css/index.css
files = $(filter-out %test.js,$(wildcard *.js))
testFiles = $(wildcard *test.js)
all: $(addprefix $o/,$(shipFiles))
node_modules/.exists: package.json
npm install
@touch $@
$o/app.js: $(files) $(testFiles) node_modules/.exists
@mkdir -p $(@D)
npm test
@mkdir -p $(@D)
$(nodeBin)/browserify $(addprefix -r ./,$(files)) -r poochie/dom -o $@ || rm -f $@
$o/index.html: index.html
@mkdir -p $(@D)
cp $< $@
$o/%: node_modules/%
@mkdir -p $(@D)
cp $< $@
clean:
rm -rf $o
rm -rf node_modules
publish: all
git show-branch gh-pages && git checkout gh-pages && git pull origin gh-pages || git checkout --orphan gh-pages && git rm -rf .
mv $o/* .
git add $(shipFiles)
git diff --cached --exit-code || git commit -m "Updated JavaScript" && git push origin gh-pages
git checkout master
@echo
@echo "Published https://garious.github.io/poochie-todomvc"