forked from segmentio/analytics.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (50 loc) · 1.17 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
##
# Binaries
##
BROWSERIFY = node_modules/.bin/browserify
ESLINT = node_modules/.bin/eslint
UGLIFYJS = node_modules/.bin/uglifyjs
##
# Files
##
SRC = $(wildcard lib/*.js)
##
# Tasks
##
# Install node modules.
node_modules: package.json $(wildcard node_modules/*/package.json)
@npm install
@touch node_modules
# Install dependencies.
install: node_modules
# Remove temporary files and build artifacts.
clean:
rm -rf *.log analytics.js analytics.min.js
.PHONY: clean
# Remove temporary files, build artifacts, and vendor dependencies.
distclean: clean
rm -rf node_modules
.PHONY: distclean
# Build analytics.js.
analytics.js: install $(SRC) package.json
@$(BROWSERIFY) lib/index.js --standalone analytics > analytics.js
git apply parsedate-changes.diff
# Build minified analytics.js.
analytics.min.js: analytics.js
@$(UGLIFYJS) $< --output $@
# Build shortcut.
build: analytics.min.js
.PHONY: build
# Lint JavaScript source files.
lint: node_modules
@$(ESLINT) $(SRC)
.PHONY: lint
# Run browser unit tests in a browser.
test-browser: install
.PHONY: test-browser
# Default test target.
test: lint test-browser
.PHONY: test
.DEFAULT_GOAL = test
test-sauce: test
.PHONY: test-sauce