forked from react-grid-layout/react-draggable
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
63 lines (48 loc) · 1.41 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
# Mostly lifted from https://andreypopp.com/posts/2013-05-16-makefile-recipes-for-node-js.html
# Thanks @andreypopp
export BIN := $(shell npm bin)
DIST = dist
LIB = $(DIST)/react-draggable.js
MIN = $(DIST)/react-draggable.min.js
.PHONY: test dev lint build clean
clean:
rm -rf dist
lint:
@$(BIN)/flow
@$(BIN)/eslint lib/* lib/utils/* specs/*
@$(BIN)/tsc -p typings
build: $(LIB) $(MIN)
# Allows usage of `make install`, `make link`
install link:
@npm $@
dist/%.js: $(BIN)
@$(BIN)/rollup -c
test: $(BIN)
@NODE_ENV=test $(BIN)/karma start --single-run
dev: $(BIN)
script/build-watch
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', './bower.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 bower.json CHANGELOG.md && \
git add -f dist/ && \
git commit -m "release v$$NEXT_VERSION" && \
git tag "v$$NEXT_VERSION" -m "release v$$NEXT_VERSION"
endef
release-patch: test clean build
@$(call release,patch)
release-minor: test clean build
@$(call release,minor)
release-major: test clean build
@$(call release,major)
publish: clean build
git push --tags origin HEAD:master
npm publish