-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefile
44 lines (34 loc) · 1014 Bytes
/
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
# Mostly lifted from https://andreypopp.com/posts/2013-05-16-makefile-recipes-for-node-js.html
# Thanks @andreypopp
export BIN := $(shell npm bin)
export NODE_ENV = test
.PHONY: lint test
lint:
@$(BIN)/eslint lib/*
test: $(BIN)
echo "No test yet."
exit 0
node_modules/.bin: install
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
['./package.json'].forEach(function(fileName) {\
var j = require(fileName);\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync(fileName, s);\
});" && \
git add package.json CHANGELOG.md && \
git commit -m "release v$$NEXT_VERSION" && \
git tag "v$$NEXT_VERSION" -m "release v$$NEXT_VERSION"
endef
release-patch: test
@$(call release,patch)
release-minor: test
@$(call release,minor)
release-major: test
@$(call release,major)
publish:
git push --tags origin HEAD:master
npm publish