2013-12-16 22:19:36 +00:00
|
|
|
|
2014-12-10 11:21:29 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
PROF =
|
|
|
|
PORT = 3449
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
SITEDIR = outsite/public
|
|
|
|
OUTPUTDIR = $(SITEDIR)/js/out
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2014-10-29 10:38:40 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
# convenience shortcuts for continous building
|
|
|
|
##############################################
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
# development build with auto-reloading
|
|
|
|
run: figwheel
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
# development build with auto-reloading and site generation
|
|
|
|
runsite:
|
2015-03-22 10:49:23 +00:00
|
|
|
@$(MAKE) run PROF=+site,$(PROF)
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2015-10-10 10:37:58 +00:00
|
|
|
# development build with auto-reloading and webpacked source
|
|
|
|
runpack: target/webpack/bundle.js
|
|
|
|
@$(MAKE) run PROF=+webpack,$(PROF)
|
|
|
|
|
2015-02-11 18:06:38 +00:00
|
|
|
# development build with figwheel, but no tests
|
|
|
|
runnotest:
|
2016-05-27 10:55:13 +00:00
|
|
|
@$(MAKE) run PROF=dev-notest,$(PROF)
|
2015-02-11 18:06:38 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
# production build with auto-rebuild
|
|
|
|
runprod: clean
|
|
|
|
@$(MAKE) serve-site PROF=prod,$(PROF)
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2015-10-10 10:37:58 +00:00
|
|
|
# production build with auto-rebuild and webpacked source
|
|
|
|
runprodpack: clean target/webpack/bundle.js
|
|
|
|
@$(MAKE) serve-site PROF=prod,webpack,$(PROF)
|
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
# production build with auto-rebuild and testing
|
|
|
|
runprodtest: clean
|
2014-11-29 22:26:42 +00:00
|
|
|
@$(MAKE) serve-site PROF=prod-test,$(PROF)
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
clean:
|
|
|
|
lein clean
|
2014-01-17 15:00:42 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
|
|
|
|
## Subtargets
|
|
|
|
|
|
|
|
figwheel: trigger-build
|
2014-11-30 08:40:12 +00:00
|
|
|
@echo "Will start figwheel server at: http://127.0.0.1:$(PORT)\n"
|
2014-11-29 17:30:24 +00:00
|
|
|
lein with-profile $(PROF), figwheel
|
|
|
|
|
|
|
|
serve-site: trigger-build
|
2014-11-30 08:40:12 +00:00
|
|
|
@echo "Starting site at: http://127.0.0.1:$(PORT)/public\n"
|
2014-01-24 10:03:01 +00:00
|
|
|
( trap "kill 0" SIGINT SIGTERM EXIT; \
|
2014-11-29 17:30:24 +00:00
|
|
|
( 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
|
2014-11-29 18:51:45 +00:00
|
|
|
@(echo "/* Generated, do not modify */\n\n" && \
|
|
|
|
cat examples/todomvc/todos.css examples/simple/example.css) \
|
|
|
|
> site/public/css/examples.css
|
2014-01-24 10:03:01 +00:00
|
|
|
|
2013-12-16 22:19:36 +00:00
|
|
|
|
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
## gh-pages support
|
|
|
|
###################
|
2013-12-16 22:19:36 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
# build site and push upstream to the gh-pages branch
|
|
|
|
push-gh-pages: build-gh-pages
|
2014-11-30 09:13:19 +00:00
|
|
|
git push origin gh-pages:gh-pages
|
2014-11-29 17:30:24 +00:00
|
|
|
|
2014-12-10 11:57:34 +00:00
|
|
|
# build site and push to reagent-project's doc site
|
2017-03-19 20:13:25 +00:00
|
|
|
push-project-docs: gen-site gen-docs
|
2017-03-10 22:36:23 +00:00
|
|
|
# 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/
|
2017-03-19 20:13:25 +00:00
|
|
|
mkdir -p tmp/docs/master/
|
|
|
|
cp -r target/doc/* tmp/docs/master/
|
2017-03-10 22:36:23 +00:00
|
|
|
cd tmp && \
|
|
|
|
git add . && git commit -m "Updated" && \
|
|
|
|
git push
|
|
|
|
rm -rf tmp
|
2014-12-10 11:57:34 +00:00
|
|
|
|
2014-12-08 12:37:25 +00:00
|
|
|
# build site into a gh-pages branch
|
2014-11-29 17:30:24 +00:00
|
|
|
build-gh-pages: gen-site gh-pages-add
|
|
|
|
|
|
|
|
gen-site: clean
|
|
|
|
lein with-profile prod cljsbuild once
|
2017-03-10 22:36:23 +00:00
|
|
|
lein with-profile prerender cljsbuild once
|
2014-11-29 17:30:24 +00:00
|
|
|
|
2017-03-19 20:13:25 +00:00
|
|
|
gen-docs: clean
|
|
|
|
lein codox
|
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
|
2015-10-10 10:37:58 +00:00
|
|
|
## Webpack
|
|
|
|
##########
|
|
|
|
|
|
|
|
target/webpack/bundle.js: node_modules lib/modules.js package.json Makefile
|
|
|
|
npm run bundle
|
|
|
|
|
|
|
|
node_modules:
|
|
|
|
npm install
|
|
|
|
|
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
## Misc utilities
|
|
|
|
#################
|
2013-12-16 22:19:36 +00:00
|
|
|
|
|
|
|
show-outdated:
|
|
|
|
lein ancient :all
|
|
|
|
|
2014-12-10 11:21:29 +00:00
|
|
|
VERSION := `sed -n -e '/(defproject reagent/ s/.*"\(.*\)"/\1/p' project.clj`
|
|
|
|
|
2013-12-16 22:19:36 +00:00
|
|
|
setversion:
|
2013-12-16 22:22:54 +00:00
|
|
|
version=$(VERSION); \
|
2014-01-26 08:51:36 +00:00
|
|
|
find . -name project.clj -o -name README.md | \
|
2014-01-17 10:12:11 +00:00
|
|
|
xargs -n1 sed -i "" -e 's,\(reagent "\)\([^"]*\)",\1'"$$version"'"',g
|
2013-12-16 22:19:36 +00:00
|
|
|
|
|
|
|
tag: setversion
|
|
|
|
if git rev-parse v$(VERSION) 2>/dev/null; then \
|
|
|
|
echo "Tag already exists"; \
|
|
|
|
exit 1; \
|
|
|
|
else \
|
2014-01-26 08:51:36 +00:00
|
|
|
git commit --allow-empty -a -v -e -m"Version "$(VERSION) && \
|
2013-12-16 22:19:36 +00:00
|
|
|
git tag v$(VERSION); \
|
|
|
|
fi
|