forked from bramp/js-sequence-diagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
98 lines (79 loc) · 2.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
.PHONY : all test dependencies clean veryclean lint
NODE_MODULES := node_modules/.bin
BOWER_COMPONENTS := bower_components
all: node_modules lint build/sequence-diagram-min.js test
node_modules: package.json
#
# NPM update needed.
#
npm update
touch $@
bower_components: bower.json
#
# Bower update needed.
#
$(NODE_MODULES)/bower update
touch $@
dependencies: node_modules bower_components
clean:
-rm build/*
veryclean: clean
-rm -rf node_modules
-rm -rf bower_components
lint: dependencies package.json bower.json
$(NODE_MODULES)/jshint --verbose src/*.js
$(NODE_MODULES)/jshint --verbose test/*.js
$(NODE_MODULES)/jsonlint package.json -q
$(NODE_MODULES)/jsonlint bower.json -q
test: dependencies build/sequence-diagram-min.js
# Test the un-minifed file (with underscore)
$(NODE_MODULES)/qunit \
-c build/sequence-diagram.js \
-t test/*-tests.js \
-d test/raphael-mock.js $(BOWER_COMPONENTS)/underscore/underscore-min.js
# Test the un-minifed file (with lodash)
$(NODE_MODULES)/qunit \
-c build/sequence-diagram.js \
-t test/*-tests.js \
-d test/raphael-mock.js $(BOWER_COMPONENTS)/lodash/lodash.min.js
# Test the minifed file (with underscore)
$(NODE_MODULES)/qunit \
-c build/sequence-diagram-min.js \
-t test/*-tests.js \
-d test/raphael-mock.js $(BOWER_COMPONENTS)/underscore/underscore-min.js
# Test the minifed file (with lodash)
$(NODE_MODULES)/qunit \
-c build/sequence-diagram-min.js \
-t test/*-tests.js \
-d test/raphael-mock.js $(BOWER_COMPONENTS)/lodash/lodash.min.js
build/grammar.js: src/grammar.jison
$(NODE_MODULES)/jison $< -o $@.tmp
# After building the grammar, run it through the uglifyjs to fix some non-strict issues.
# Until https://github.com/zaach/jison/issues/285 is fixed, we must do this to create valid non-minified code.
$(NODE_MODULES)/uglifyjs \
$@.tmp -o $@ \
--comments all --compress --beautify
build/diagram-grammar.js: src/diagram.js build/grammar.js
#
# Compiling grammar
#
$(NODE_MODULES)/preprocess $< . > $@
build/sequence-diagram.js: src/main.js build/diagram-grammar.js src/jquery-plugin.js fonts/daniel/daniel_700.font.js src/sequence-diagram.js
#
# Finally combine all javascript files together
#
$(NODE_MODULES)/preprocess $< . > $@
build/sequence-diagram-min.js build/sequence-diagram-min.js.map: build/sequence-diagram.js
#
# Please ignore the warnings below (these are in combined js code)
#
$(NODE_MODULES)/uglifyjs \
build/sequence-diagram.js \
-o build/sequence-diagram-min.js \
--compress --comments --lint \
--source-map build/sequence-diagram-min.js.map \
--source-map-url sequence-diagram-min.js.map
#
# Copy minified file to site
#
cp build/sequence-diagram-min.js* _site/