forked from reagent-project/reagent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
145 lines (108 loc) · 3.54 KB
/
Makefile
File metadata and controls
145 lines (108 loc) · 3.54 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
PROF =
PORT = 3449
SITEDIR = outsite/public
OUTPUTDIR = $(SITEDIR)/js/out
# convenience shortcuts for continous building
##############################################
# development build with auto-reloading
run: figwheel
# development build with auto-reloading and site generation
runsite:
@$(MAKE) run PROF=+site,$(PROF)
# development build with auto-reloading and webpacked source
runpack: target/webpack/bundle.js
@$(MAKE) run PROF=+webpack,$(PROF)
# development build with figwheel, but no tests
runnotest:
@$(MAKE) run PROF=dev-notest,$(PROF)
# production build with auto-rebuild
runprod: clean
@$(MAKE) serve-site PROF=prod,$(PROF)
# production build with auto-rebuild and webpacked source
runprodpack: clean target/webpack/bundle.js
@$(MAKE) serve-site PROF=prod,webpack,$(PROF)
# production build with auto-rebuild and testing
runprodtest: clean
@$(MAKE) serve-site PROF=prod-test,$(PROF)
clean:
lein clean
## Subtargets
figwheel: trigger-build
@echo "Will start figwheel server at: http://127.0.0.1:$(PORT)\n"
lein with-profile $(PROF), figwheel
serve-site: trigger-build
@echo "Starting site at: http://127.0.0.1:$(PORT)/public\n"
( trap "kill 0" SIGINT SIGTERM EXIT; \
( cd $(SITEDIR)/.. && python -m SimpleHTTPServer $(PORT) & ); \
lein with-profile $(PROF), cljsbuild auto )
trigger-build:
# always trigger build to make sure page-generation works
@echo "(ns empty.generated.ns)" > demo/empty.cljs
@(echo "/* Generated, do not modify */\n\n" && \
cat examples/todomvc/todos.css examples/simple/example.css) \
> site/public/css/examples.css
## gh-pages support
###################
# build site and push upstream to the gh-pages branch
push-gh-pages: build-gh-pages
git push origin gh-pages:gh-pages
# build site and push to reagent-project's doc site
push-project-docs: gen-site gen-docs
# sanity check
test -f $(SITEDIR)/index.html
test ! -e $(OUTPUTDIR)
rm -fr tmp
git clone git@github.com:reagent-project/reagent-project.github.io.git tmp
rm -fr tmp/*
cp -r $(SITEDIR)/* tmp/
mkdir -p tmp/docs/master/
cp -r target/doc/* tmp/docs/master/
cd tmp && \
git add . && git commit -m "Updated" && \
git push
rm -rf tmp
# build site into a gh-pages branch
build-gh-pages: gen-site gh-pages-add
gen-site: clean
lein with-profile prod cljsbuild once
lein with-profile prerender cljsbuild once
gen-docs: clean
lein codox
# copy contents of $(SITEDIR) to branch gh-pages
gh-pages-add:
# sanity check
test -f $(SITEDIR)/index.html
test ! -e $(OUTPUTDIR)
# make sure gh-pages branch exists
git show-branch gh-pages || true | git mktree | \
xargs git commit-tree | xargs git branch gh-pages
# clone gh-pages branch, and commit site to that
cd $(SITEDIR) && \
rm -rf .git tmp && \
git clone ../.. -lnb gh-pages tmp && \
mv tmp/.git . && \
git add . && git commit -m "Updated" && \
git push && rm -rf .git tmp
## Webpack
##########
target/webpack/bundle.js: node_modules lib/modules.js package.json Makefile
npm run bundle
node_modules:
npm install
## Misc utilities
#################
show-outdated:
lein ancient :all
VERSION := `sed -n -e '/(defproject reagent/ s/.*"\(.*\)"/\1/p' project.clj`
setversion:
version=$(VERSION); \
find . -name project.clj -o -name README.md | \
xargs -n1 sed -i "" -e 's,\(reagent "\)\([^"]*\)",\1'"$$version"'"',g
tag: setversion
if git rev-parse v$(VERSION) 2>/dev/null; then \
echo "Tag already exists"; \
exit 1; \
else \
git commit --allow-empty -a -v -e -m"Version "$(VERSION) && \
git tag v$(VERSION); \
fi