-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (41 loc) · 1.24 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
BIN = ./node_modules/.bin
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_')
SRC = $(wildcard *.coffee)
LIB = $(SRC:%.coffee=%.js)
develop:
@$(BIN)/supervisor -q \
-i node_modules/ \
-e 'coffee|js' \
-x $(BIN)/coffee \
-- cmd.coffee
build: $(LIB)
install link dedupe:
@npm $@
test:
@#$(BIN)/mocha -t 5000 -b -R spec spec.js
cmd.js: cmd.coffee
@echo '#!/usr/bin/env node' > $@
@$(BIN)/coffee -bcp $< >> $@
%.js: %.coffee
@$(BIN)/coffee -bcp $< > $@
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