-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (102 loc) · 3 KB
/
Makefile
File metadata and controls
130 lines (102 loc) · 3 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# if no "v" var given, default to package version
v ?= $(shell node -pe "require('./package.json').version")
# expand variable (so we can use it on branches w/o package.json)
VERSION := $(v)
# get x.x.* part of the version number
MINOR_VERSION = `echo $(VERSION) | sed 's/\.[^.]*$$//'`
# Command line paths
KARMA = ./node_modules/karma/bin/karma
ESLINT = ./node_modules/eslint/bin/eslint.js
MOCHA = ./node_modules/mocha/bin/_mocha
ROLLUP = ./node_modules/rollup/bin/rollup
MINIFY = ./node_modules/.bin/terser
COVERALLS = ./node_modules/coveralls/bin/coveralls.js
RIOT_CLI = ./node_modules/.bin/riot
TSC = ./node_modules/.bin/tsc
# folders
DIST = dist/riot/
SRC = src
CONFIG = config/
GENERATED_FILES = riot.js riot+compiler.js
test: eslint test-karma test-typing
test-karma:
@ $(KARMA) start test/karma.conf.js
eslint:
# check code style
@ $(ESLINT) -c ./.eslintrc src test
test-coveralls:
@ RIOT_COV=1 cat ./coverage/report-lcov/lcov.info | $(COVERALLS)
test-debug:
@ ${KARMA} start test/karma.conf.js --browsers=Chrome --no-single-run --watch
test-sauce:
# run the riot tests on saucelabs
@ SAUCELABS=1 make test-karma
test-typing:
# silent compile typescript
@ $(TSC) -p ./test
raw:
# build riot
@ mkdir -p $(DIST)
# Default builds UMD
@ $(ROLLUP) src/riot.js --format umd --config rollup.config.js > $(DIST)riot.js
@ $(ROLLUP) src/riot+compiler.js --format umd --config rollup.config.js > $(DIST)riot+compiler.js
@ $(ROLLUP) src/riot.js --format esm --config rollup.config.js > $(DIST)riot.esm.js
clean:
# clean $(DIST)
@ rm -rf $(DIST)
riot: clean raw test
min:
# minify riot
@ for f in $(GENERATED_FILES); do \
$(MINIFY) $(DIST)$$f \
--comments \
--toplevel \
--mangle \
--compress \
-o $(DIST)$${f%.*}.min.js; \
done
build:
# generate riot.js & riot.min.js
@ make min
@ cp dist/riot/* .
# write version in riot.js
@ sed -i '' 's/WIP/v$(VERSION)/g' riot*.js
bump:
# grab all latest changes to master
# (if there's any uncommited changes, it will stop here)
# bump version in *.json files
@ sed -i '' 's/\("version": "\)[^"]*/\1'$(VERSION)'/' package.json
@ make build
@ git status --short
bump-undo:
# remove all uncommited changes
@ git reset --hard
version:
# @ git checkout master
# create version commit
@ git status --short
@ git add --all
@ git commit -am "$(VERSION)"
@ git log --oneline -2
# create version tag
@ git tag -a 'v'$(VERSION) -m $(VERSION)
@ git describe
version-undo:
# remove the version tag
@ git tag -d 'v'$(VERSION)
@ git describe
# remove the version commit
@ git reset `git rev-parse :/$(VERSION)`
@ git reset HEAD^
@ git log --oneline -2
release: riot min bump version
release-undo:
make version-undo
make bump-undo
publish:
# push new version to npm and github
# (github tag will also trigger an update in bower, component, cdnjs, etc)
@ npm publish
@ git push origin master
@ git push origin master --tags
.PHONY: test min eslint test-coveralls test-sauce raw riot build bump bump-undo version version-undo release-undo publish