-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
95 lines (74 loc) · 2.13 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
84
85
86
87
88
89
90
91
92
93
94
95
SRC = $(wildcard src/*.js)
SNIPPET = src/rakam-snippet.js
TESTS = $(wildcard test/*.js)
BINS = node_modules/.bin
MINIFY = $(BINS)/uglifyjs
JSDOC = $(BINS)/jsdoc
JSHINT = $(BINS)/jshint
BUILD_DIR = build
PROJECT = rakam
OUT = $(PROJECT).js
SNIPPET_OUT = $(PROJECT)-snippet.min.js
SEGMENT_SNIPPET_OUT = $(PROJECT)-segment-snippet.min.js
MIN_OUT = $(PROJECT).min.js
MOCHA = $(BINS)/mocha-phantomjs
KARMA = $(BINS)/karma
ROLLUP = $(BINS)/rollup
#
# Default target.
#
default: test
#
# Clean.
#
clean:
@-rm -f rakam.js rakam.beta.min.js
@-rm -rf node_modules npm-debug.log
#
# Test.
#
test: build
@$(KARMA) start karma.conf.js
test-sauce: build
@$(KARMA) start karma.conf.js --browsers sauce_chrome_windows
#
# Target for `node_modules` folder.
#
node_modules: package.json
@yarn
#
# Target for updating version.
version: package.json
node scripts/version
#
# Target for updating readme.
README.md: $(SNIPPET_OUT) version
node scripts/readme
#
# Target for `rakam.js` file.
#
$(OUT): node_modules $(SRC) package.json rollup.config.js rollup.min.js rollup.native.js rollup.esm.js rollup.umd.js rollup.umd.min.js
@$(JSHINT) --verbose $(SRC)
@NODE_ENV=production $(ROLLUP) --config rollup.config.js
@NODE_ENV=production $(ROLLUP) --config rollup.esm.js
@NODE_ENV=production $(ROLLUP) --config rollup.umd.js
@NODE_ENV=production $(ROLLUP) --config rollup.native.js
@NODE_ENV=production $(ROLLUP) --config rollup.nocompat.js
@NODE_ENV=production $(ROLLUP) --config rollup.umd.min.js
@NODE_ENV=production $(ROLLUP) --config rollup.min.js
@NODE_ENV=production $(ROLLUP) --config rollup.nocompat.min.js
#
# Target for minified `rakam-snippet.js` file.
#
$(SNIPPET_OUT): $(SRC) $(SNIPPET)
@$(JSHINT) --verbose $(SNIPPET)
@$(MINIFY) $(SNIPPET) -m -b max-line-len=80,beautify=false | awk 'NF' > $(SNIPPET_OUT)
$(SEGMENT_SNIPPET_OUT): $(SRC) $(SNIPPET)
@grep -Ev "\ba?s\b" $(SNIPPET) | $(MINIFY) -m -b max-line-len=80,beautify=false - \
| awk 'NF' > $(SEGMENT_SNIPPET_OUT)
#
# Target for `tests-build.js` file.
#
build: $(TESTS) $(OUT) $(SNIPPET_OUT) $(SEGMENT_SNIPPET_OUT)
@$(ROLLUP) --config rollup.test.js
@$(ROLLUP) --config rollup.snippet-tests.js