-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
48 lines (38 loc) · 1.46 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
default: build
CHANGELOG=CHANGELOG
SRC = $(shell find src -name "*.coffee" -type f | sort)
LIB = $(SRC:src/%.coffee=lib/%.js)
COFFEE=node_modules/.bin/coffee --js
MOCHA=node_modules/.bin/mocha --compilers coffee:coffee-script-redux/register -r coffee-script-redux/register -r test-setup.coffee -u tdd
all: build test
build: $(LIB)
lib/%.js: src/%.coffee
@dirname "$@" | xargs mkdir -p
$(COFFEE) <"$<" >"$@"
.PHONY: release test loc clean
VERSION = $(shell node -pe 'require("./package.json").version')
release-patch: NEXT_VERSION = $(shell node -pe 'require("semver").inc("$(VERSION)", "patch")')
release-minor: NEXT_VERSION = $(shell node -pe 'require("semver").inc("$(VERSION)", "minor")')
release-major: NEXT_VERSION = $(shell node -pe 'require("semver").inc("$(VERSION)", "major")')
release-patch: release
release-minor: release
release-major: release
release: build test
@printf "Current version is $(VERSION). This will publish version $(NEXT_VERSION). Press [enter] to continue." >&2
@read
./changelog.sh "v$(NEXT_VERSION)" >"$(CHANGELOG)"
node -e '\
var j = require("./package.json");\
j.version = "$(NEXT_VERSION)";\
var s = JSON.stringify(j, null, 2) + "\n";\
require("fs").writeFileSync("./package.json", s);'
git commit package.json "$(CHANGELOG)" -m 'Version $(NEXT_VERSION)'
git tag -a "v$(NEXT_VERSION)" -m "Version $(NEXT_VERSION)"
git push --tags origin HEAD:master
npm publish
test:
$(MOCHA) -R dot test/*.coffee
loc:
@wc -l src/*
clean:
@rm -rf lib