-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathMakefile
59 lines (51 loc) · 1.63 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
help:
@echo 'Usage: make [target]'
@echo
@echo 'Targets:'
@echo ' test Run tests.'
@echo ' coverage Run test coverage.'
@echo ' docs Generate documentation.'
@echo ' deps Install development dependencies.'
@echo ' live Push examples to GitHub pages.'
test: FORCE
npm test
coverage: FORCE
npm run coverage
doc: FORCE
rm -rf doc
npm run doc
deps:
npm install
site: doc
# Clone external packages.
rm -rf _site/ && mkdir -p _site/examples/
git -C _site/ clone -b v4.0.12 --depth 1 https://github.com/markedjs/marked.git
git -C _site/ clone -b 3.2.0 --depth 1 https://github.com/mathjax/mathjax.git
rm -rf _site/marked/.git/
rm -rf _site/mathjax/.git/
# Create texme.js that loads external packages from same domain.
sed -e 's|https:.*marked.min.js|https://susam.github.io/texme/marked/marked.min.js|' \
-e 's|https:.*chtml.js|https://susam.github.io/texme/mathjax/es5/tex-mml-chtml.js|' \
texme.js > _site/texme.js
npx uglifyjs _site/texme.js --compress --mangle --output _site/texme.min.js
# Copy examples and create home page.
cp examples/*.html _site/examples/
sed 's|\.\./texme.js|texme.js|' examples/demo.html > _site/index.html
# Copy documentation.
mv doc/ _site/
pushlive:
pwd | grep live$$ || false
git init
git config user.name live
git config user.email live@localhost
git remote add origin https://github.com/susam/texme.git
git checkout -b live
git add .
git commit -m "Publish live ($$(date -u +"%Y-%m-%d %H:%M:%S"))"
git log
git push -f origin live
live: site
rm -rf /tmp/live
mv _site /tmp/live
REPO_DIR="$$PWD"; cd /tmp/live && make -f "$$REPO_DIR/Makefile" pushlive
FORCE: