forked from react-grid-layout/react-draggable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
64 lines (50 loc) · 1.57 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
64
# Mostly lifted from https://andreypopp.com/posts/2013-05-16-makefile-recipes-for-node-js.html
# Thanks @andreypopp
BIN = ./node_modules/.bin
SRC = $(wildcard lib/*.js)
LIB = $(SRC:lib/%.js=dist/%.js)
MIN = $(SRC:lib/%.js=dist/%.min.js)
.PHONY: test dev
build: $(LIB) $(MIN)
# Allows usage of `make install`, `make link`
install link:
@npm $@
# FIXME
dist/%.min.js: $(BIN)
@$(BIN)/uglifyjs dist/react-draggable.js \
--output dist/react-draggable.min.js \
--source-map dist/react-draggable.min.map \
--source-map-url react-draggable.min.map \
--in-source-map dist/react-draggable.map \
--compress warnings=false
dist/%.js: $(BIN)
@$(BIN)/webpack --devtool source-map
test: $(BIN)
@$(BIN)/karma start --browsers Firefox --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 build
@$(call release,patch)
release-minor: test build
@$(call release,minor)
release-major: test build
@$(call release,major)
publish:
git push --tags origin HEAD:master
npm publish