-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
49 lines (40 loc) · 1.31 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
BROWSERIFY = node ./node_modules/browserify/bin/cmd.js
MOCHA = ./node_modules/.bin/mocha
UGLIFYJS = ./node_modules/.bin/uglifyjs
BANNER = "/*! lil-uuid - v0.1 - MIT License - https://github.com/lil-js/uuid */"
MOCHA_PHANTOM = ./node_modules/.bin/mocha-phantomjs
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);" && \
node -e "\
var j = require('./bower.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./bower.json', s);" && \
git commit -am "release $$NEXT_VERSION" && \
git tag "$$NEXT_VERSION" -m "Version $$NEXT_VERSION"
endef
default: all
all: test
browser: uglify
test: browser mocha
uglify:
$(UGLIFYJS) uuid.js --mangle --preamble $(BANNER) --source-map uuid.min.js.map > uuid.min.js
mocha:
$(MOCHA_PHANTOM) --reporter spec --ui bdd test/runner.html
$(MOCHA) --reporter spec --ui bdd
loc:
wc -l uuid.js
gzip:
gzip -c uuid.js | wc -c
release:
@$(call release, patch)
release-minor:
@$(call release, minor)
publish: browser release
git push --tags origin HEAD:master