-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
83 lines (61 loc) · 2.11 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
VERSION = $(shell cat package.json | sed -n 's/.*"version": "\([^"]*\)",/\1/p')
SHELL = /usr/bin/env bash
default: install
.PHONY: default test install tag remove_tag
version:
@echo $(VERSION)
install:
npm install
$$(npm bin)/jspm install
build_node:
$$(npm bin)/jspm build lessjs src/bundled_less/less.node.js --node --minify
build_browser:
$$(npm bin)/jspm build lessjs/dist/less.js src/bundled_less/less.browser.js --minify
build_jspm_less_plugin:
$$(npm bin)/babel jspm-less-plugin/es6 -d jspm-less-plugin
$$(npm bin)/jspm build jspm-less-plugin/index.js src/jspm-less-plugin.js
build: build_node build_browser build_jspm_less_plugin
test:
$$(npm bin)/mocha
update_version:
ifeq ($(shell expr "${CURRENT_MAJOR}" \> "$(NEXT_MAJOR)"),1)
$(error "v" parameter is lower than current version ${VERSION})
endif
ifeq ($(shell expr "${CURRENT_MINOR}" \> "$(NEXT_MINOR)"),1)
$(error "v" parameter is lower than current version ${VERSION})
endif
ifeq ($(shell expr "${CURRENT_HOTFIX}" \> "$(NEXT_HOTFIX)"),1)
$(error "v" parameter is lower than current version ${VERSION})
endif
ifeq ($(v),)
$(error v is undefined. Use e.g. make tag v=1.0.0 or make release v=1.0.0)
endif
ifeq (${VERSION},$(v))
$(error v is already the current version)
endif
@echo "Current version is " ${VERSION}
@echo "Next version is " $(v)
sed -i s/"$(VERSION)"/"$(v)"/g package.json
check_version:
$(eval SPLIT_VERSION = $(subst ., ,${VERSION}))
$(eval NEXT_VERSION := $(subst ., ,${v}))
$(eval CURRENT_MAJOR := $(word 1,$(SPLIT_VERSION)))
$(eval CURRENT_MINOR := $(word 2,$(SPLIT_VERSION)))
$(eval CURRENT_HOTFIX := $(word 3,$(SPLIT_VERSION)))
$(eval NEXT_MAJOR := $(word 1,$(NEXT_VERSION)))
$(eval NEXT_MINOR := $(word 2,$(NEXT_VERSION)))
$(eval NEXT_HOTFIX := $(word 3,$(NEXT_VERSION)))
tag_and_push:
git add --all
git commit -a -m "Tag v $(v) $(m)"
git tag v$(v)
git push
git push --tags
tag: build release
release: test check_version update_version tag_and_push
remove_tag:
ifeq ($(t),)
$(error t is undefined, you must config a tag name. e.g. make remove_tag t=v1.0.0)
endif
git tag -d $(t)
git push origin :refs/tags$(t)