forked from dagrejs/dagre-d3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (64 loc) · 2.03 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
# Binaries we use
NODE = node
NPM = npm
BROWSERIFY = ./node_modules/browserify/bin/cmd.js
JSCS = ./node_modules/jscs/bin/jscs
JSHINT = ./node_modules/jshint/bin/jshint
MOCHA = ./node_modules/mocha/bin/_mocha
MOCHA_PHANTOMJS = ./node_modules/mocha-phantomjs/bin/mocha-phantomjs
PHANTOMJS = ./node_modules/phantomjs/bin/phantomjs
UGLIFY = ./node_modules/uglify-js/bin/uglifyjs
# Module def
MODULE = dagre-d3
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')
DEMO_FILES = $(wildcard demo/*)
DEMO_BUILD_FILES = $(addprefix build/, $(DEMO_FILES))
TEST_COV = build/coverage
# Targets
.PHONY: all test mocha-test demo-test lint release clean fullclean
.DELETE_ON_ERROR:
all: build test
lib/version.js: package.json src/release/make-version.js
$(NODE) src/release/make-version.js > $@
build: build/$(MODULE_JS) build/$(MODULE_MIN_JS) build/bower.json build/demo
build/demo: $(DEMO_BUILD_FILES)
build/demo/%: demo/%
mkdir -p $(@D)
sed 's|\.\./build/dagre-d3.js|../dagre-d3.js|' < $< > $@
build/bower.json: package.json src/release/make-bower.json.js
$(NODE) src/release/make-bower.json.js > $@
build/$(MODULE_JS): browser.js node_modules $(SRC_FILES)
mkdir -p $(@D)
$(BROWSERIFY) $(BROWSERIFY_OPTS) -x node_modules/d3/index-browserify.js $< > $@
build/$(MODULE_MIN_JS): build/$(MODULE_JS)
$(UGLIFY) $(UGLIFY_OPTS) $< > $@
dist: build/$(MODULE_JS) build/$(MODULE_MIN_JS) build/demo build/bower.json | test
rm -rf $@
mkdir -p $@
cp -r $^ dist
test: build mocha-test demo-test lint
mocha-test: test/index.html
$(MOCHA_PHANTOMJS) $?
demo-test: test/demo-test.js $(SRC_FILES) node_modules
$(PHANTOMJS) $<
lint: build/lint
build/lint: browser.js $(SRC_FILES) $(TEST_FILES)
mkdir -p $(@D)
$(JSHINT) $?
$(JSCS) $?
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
rm -f bower.json
node_modules: package.json
$(NPM) install
touch node_modules