forked from dagrejs/dagre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (56 loc) · 1.67 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
# Binaries we use
NODE = node
NPM = npm
BROWSERIFY = ./node_modules/browserify/bin/cmd.js
ISTANBUL = ./node_modules/istanbul/lib/cli.js
JSHINT = ./node_modules/jshint/bin/jshint
MOCHA = ./node_modules/mocha/bin/_mocha
PHANTOMJS = ./node_modules/phantomjs/bin/phantomjs
UGLIFY = ./node_modules/uglify-js/bin/uglifyjs
# Module def
MODULE = dagre
MODULE_JS = $(MODULE).js
MODULE_MIN_JS = $(MODULE).min.js
# Various files
SRC_FILES = index.js lib/version.js $(shell find lib -type f -name '*.js')
TEST_FILES= $(shell find test -type f -name '*.js')
TEST_COV = build/coverage
# Targets
.PHONY: = all test lint release clean fullclean
.DELETE_ON_ERROR:
all: build test
lib/version.js: package.json
$(NODE) src/version.js > $@
build: build/$(MODULE_JS) build/$(MODULE_MIN_JS)
build/$(MODULE_JS): browser.js node_modules $(SRC_FILES)
mkdir -p $(@D)
$(BROWSERIFY) $(BROWSERIFY_OPTS) $< > $@
build/$(MODULE_MIN_JS): build/$(MODULE_JS)
$(UGLIFY) $(UGLIFY_OPTS) $< > $@
dist: build/$(MODULE_JS) build/$(MODULE_MIN_JS) | test
rm -rf $@
mkdir -p $@
cp $^ dist
test: $(TEST_COV) lint
$(TEST_COV): $(TEST_FILES) $(SRC_FILES) node_modules
rm -rf $@
$(MOCHA) $(MOCHA_OPTS) $(TEST_FILES)
# Instanbul instrumentation appears to mess up stack traces, so we run it after
# ensuring the tests are passing
$(ISTANBUL) cover $(MOCHA) --dir $@ -- $(MOCHA_OPTS) $(TEST_FILES) >/dev/null
lint: build/lint
build/lint: browser.js $(SRC_FILES) $(TEST_FILES)
mkdir -p $(@D)
$(JSHINT) $?
touch $@
@echo
release: dist
src/release/release.sh $(MODULE) dist
clean:
rm -rf build dist
fullclean: clean
rm -rf ./node_modules
rm -f lib/version.js
node_modules: package.json
$(NPM) install
touch node_modules