-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (57 loc) · 2.09 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
# Command line paths
KARMA = ./node_modules/karma/bin/karma
ISTANBUL = ./node_modules/karma-coverage/node_modules/.bin/istanbul
ESLINT = ./node_modules/eslint/bin/eslint.js
MOCHA = ./node_modules/mocha/bin/_mocha
SMASH = ./node_modules/.bin/smash
UGLIFY = ./node_modules/uglify-js/bin/uglifyjs
COVERALLS = ./node_modules/coveralls/bin/coveralls.js
# folders
DIST = "dist/riot/"
# utils
WATCH = "\
var arg = process.argv, path = arg[1], cmd = arg[2]; \
require('chokidar') \
.watch(path, { ignoreInitial: true }) \
.on('all', function() { \
require('shelljs').exec(cmd) \
})"
test: eslint test-mocha test-karma
eslint:
# check code style
@ $(ESLINT) -c ./.eslintrc lib test
test-mocha:
RIOT=../../dist/riot/riot.js $(ISTANBUL) cover $(MOCHA) -- test/runner.js -R spec
test-karma:
@ $(KARMA) start test/karma.conf.js
test-coveralls:
@ RIOT_COV=1 cat ./coverage/browsers/report-lcov/lcov.info | $(COVERALLS)
test-sauce:
# run the saucelabs in separate chunks
# we need to run the test on 12 different browsers divided in 6 groups
@ for group in 0 1 2 3 4 5 6; do GROUP=$$group SAUCELABS=1 make test-karma; done
compare:
# compare the current release with the previous one
du -h riot.min.js riot+compiler.min.js
du -h dist/riot/riot.min.js dist/riot/riot+compiler.min.js
raw:
# build riot
@ mkdir -p $(DIST)
@ $(SMASH) lib/riot.js > $(DIST)riot.js
@ $(SMASH) lib/riot+compiler.js > $(DIST)riot+compiler.js
riot: raw test
min: riot
# minify riot
@ for f in riot riot+compiler; do $(UGLIFY) $(DIST)$$f.js --comments --mangle -o $(DIST)$$f.min.js; done
perf: riot
# run the performance tests
@ node --expose-gc test/performance/speed
@ node --expose-gc test/performance/mem
watch:
# watch and rebuild riot and its tests
@ $(shell \
node -e $(WATCH) "lib/**/*.js" "make raw" & \
export RIOT="./../../../../dist/riot/riot" && ./node_modules/.bin/riot --watch test/tag dist/tags.js)
.PHONY: test min eslint test-mocha test-compiler test-coveralls test-sauce compare raw riot perf watch
# riot maintainer tasks
-include ../riot-tasks/Makefile