-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathMakefile
74 lines (57 loc) · 1.47 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
BIN = ./node_modules/.bin
SRC = $(shell find src -name '*.js')
LIB = $(SRC:src/%=lib/%)
BABEL_OPTS = \
--stage 0
TEST_SUITES = $(wildcard ./src/__tests__/*.js)
TEST_SUITES_COMMON = $(filter-out %-browser-test.js %-server-test.js, $(TEST_SUITES))
TEST_SUITES_BROWSER = $(filter %-browser-test.js, $(TEST_SUITES))
TEST_SUITES_SERVER = $(filter %-server-test.js, $(TEST_SUITES))
build: $(LIB)
example::
@$(BIN)/babel-node $(BABEL_OPTS) ./example/server.js
install link:
@npm $@
test:: test-server test-browser
test-server::
@$(BIN)/mocha \
-R dot \
--compilers js:./scripts/register-babel \
$(TEST_SUITES_COMMON) \
$(TEST_SUITES_SERVER)
ci-server::
@$(BIN)/mocha \
--watch \
-R dot \
--compilers js:./scripts/register-babel \
$(TEST_SUITES_COMMON) \
$(TEST_SUITES_SERVER)
test-browser::
@$(BIN)/mochify \
--transform [ babelify $(BABEL_OPTS) ] \
$(TEST_SUITES_COMMON) \
$(TEST_SUITES_BROWSER)
ci-browser:: build
@$(BIN)/mochify \
--watch \
--transform [ babelify $(BABEL_OPTS) ] \
$(TEST_SUITES_COMMON:lib/%=./src/%) \
$(TEST_SUITES_BROWSER:lib/%=./src/%)
release-patch: test lint
@$(call release,patch)
release-minor: test lint
@$(call release,minor)
release-major: test lint
@$(call release,major)
publish:
git push --tags origin HEAD:master
npm publish
lib/%.js: src/%.js
@echo "building $@"
@mkdir -p $(@D)
@$(BIN)/babel $(BABEL_OPTS) --source-maps-inline -o $@ $<
clean:
@rm -f $(LIB)
define release
npm version $(1)
endef