forked from markdown-it/markdown-it
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
110 lines (90 loc) · 3.48 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
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
PATH := ./node_modules/.bin:${PATH}
NPM_PACKAGE := $(shell node -e 'process.stdout.write(require("./package.json").name)')
NPM_VERSION := $(shell node -e 'process.stdout.write(require("./package.json").version)')
TMP_PATH := /tmp/${NPM_PACKAGE}-$(shell date +%s)
REMOTE_NAME ?= origin
REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut -b -6) master)
GITHUB_PROJ := https://github.com//markdown-it/${NPM_PACKAGE}
demo: lint
rm -rf ./demo
mkdir ./demo
./support/demodata.js > ./support/demo_template/sample.json
jade ./support/demo_template/index.jade --pretty \
--obj ./support/demo_template/sample.json \
--out ./demo
stylus -u autoprefixer-stylus \
< ./support/demo_template/index.styl \
> ./demo/index.css
rm -rf ./support/demo_template/sample.json
browserify ./ -s markdownit > ./demo/markdown-it.js
browserify ./support/demo_template/index.js > ./demo/index.js
cp ./support/demo_template/README.md ./demo/
gh-demo: demo
touch ./demo/.nojekyll
cd ./demo \
&& git init . \
&& git add . \
&& git commit -m "Auto-generate demo" \
&& git remote add origin [email protected]:markdown-it/markdown-it.github.io.git \
&& git push --force origin master
rm -rf ./demo
lint:
eslint .
test: lint
mocha
echo "CommonMark stat:\n"
./support/specsplit.js test/fixtures/commonmark/spec.txt
coverage:
rm -rf coverage
istanbul cover node_modules/.bin/_mocha
report-coverage:
-istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
doc:
rm -rf ./apidoc
ndoc --link-format "https://github.com/{package.repository}/blob/${CURR_HEAD}/{file}#L{line}"
gh-doc: doc
touch ./apidoc/.nojekyll
cd ./apidoc \
&& git init . \
&& git add . \
&& git commit -m "Auto-generate API doc" \
&& git remote add remote [email protected]:markdown-it/markdown-it.git \
&& git push --force remote +master:gh-pages
rm -rf ./apidoc
publish:
@if test 0 -ne `git status --porcelain | wc -l` ; then \
echo "Unclean working tree. Commit or stash changes first." >&2 ; \
exit 128 ; \
fi
@if test 0 -ne `git fetch ; git status | grep '^# Your branch' | wc -l` ; then \
echo "Local/Remote history differs. Please push/pull changes." >&2 ; \
exit 128 ; \
fi
@if test 0 -ne `git tag -l ${NPM_VERSION} | wc -l` ; then \
echo "Tag ${NPM_VERSION} exists. Update package.json" >&2 ; \
exit 128 ; \
fi
git tag ${NPM_VERSION} && git push origin ${NPM_VERSION}
npm publish ${GITHUB_PROJ}/tarball/${NPM_VERSION}
browserify:
rm -rf ./dist
mkdir dist
# Browserify
( printf "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" ; \
browserify ./ -s markdownit \
) > dist/markdown-it.js
# Minify
terser dist/markdown-it.js -b beautify=false,ascii_only=true -c -m \
--preamble "/*! ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} @license MIT */" \
> dist/markdown-it.min.js
benchmark-deps:
npm install --prefix benchmark/extra/ -g [email protected] [email protected] markdown-it/markdown-it.git#2.2.1
specsplit:
./support/specsplit.js good ./test/fixtures/commonmark/spec.txt > ./test/fixtures/commonmark/good.txt
./support/specsplit.js bad ./test/fixtures/commonmark/spec.txt > ./test/fixtures/commonmark/bad.txt
./support/specsplit.js ./test/fixtures/commonmark/spec.txt
todo:
grep 'TODO' -n -r ./lib 2>/dev/null || test true
.PHONY: publish lint test todo demo coverage doc
.SILENT: help lint test todo