forked from andreypopp/less2stylus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (50 loc) · 1.45 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
BIN = ./node_modules/.bin
SRC = $(wildcard *.coffee)
LIB = $(SRC:%.coffee=%.js)
REPO = $(shell cat .git/config | grep url | xargs echo | sed -E 's/^url = //g')
REPONAME = $(shell echo $(REPO) | sed -E 's_.+:([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-]+)\.git_\1/\2_')
build: $(LIB)
%.js: %.coffee
@mkdir -p $(@D)
@$(BIN)/coffee -bcp $< > $@
clean:
@rm -f $(LIB)
install link:
@npm $@
test:
@#$(BIN)/mocha -b -R spec --compilers coffee:coffee-script ./spec.coffee
docs::
@sphinx-npm \
-C -E -a \
-Dhtml_theme_path=. \
-Dhtml_theme=noisy \
-Dmaster_doc=index \
-Agithub_repo='$(REPONAME)' \
./docs ./docs/build
docs-push::
rm -rf ./docs/build
$(MAKE) docs
touch ./docs/build/.nojekyll
(cd ./docs/build;\
git init && git add . && git ci -m 'docs' &&\
git push -f $(REPO) master:gh-pages)
release-patch: build test
@$(call release,patch)
release-minor: build test
@$(call release,minor)
release-major: build test
@$(call release,major)
publish:
git push --tags origin HEAD:master
npm publish
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./package.json', s);" && \
git commit -m "release $$NEXT_VERSION" -- package.json && \
git tag "$$NEXT_VERSION" -m "release $$NEXT_VERSION"
endef