Bug: Allow points where canvas-y === 0
[dygraphs.git] / scripts / build.sh
1 #!/bin/bash
2 # This generates:
3 # - dist/dygraph.js
4 # - dist/dygraph.js.map
5 # - dist/dygraph.min.js
6 # - dist/dygraph.min.js.map
7 set -o errexit
8
9 mkdir -p dist
10
11 # Create dist/dygraph.js
12 browserify \
13 -v \
14 -t babelify \
15 -t [ envify --NODE_ENV development ] \
16 --debug \
17 --standalone Dygraph \
18 src/dygraph.js \
19 > dist/dygraph.tmp.js
20
21 # Create dist/dygraph.js.map
22 cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.js.map > dist/dygraph.js
23
24 # Create "production" bundle for minification
25 browserify \
26 -v \
27 -t babelify \
28 -t [ envify --NODE_ENV production ] \
29 --debug \
30 --standalone Dygraph \
31 src/dygraph.js \
32 > dist/dygraph.tmp.js
33
34 # Create dist/dygraph.tmp.js.map
35 cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.tmp.js.map > /dev/null
36
37 header='/*! @license Copyright 2014 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */'
38
39 # Create dist/dygraph.js.min{,.map}
40 uglifyjs --compress --mangle \
41 --preamble "$header" \
42 --in-source-map dist/dygraph.tmp.js.map \
43 --source-map-include-sources \
44 --source-map dist/dygraph.min.js.map \
45 -o dist/dygraph.min.js \
46 dist/dygraph.tmp.js
47
48 # Copy to the old location
49 cp dist/dygraph.min.js dist/dygraph-combined.js
50
51 # Build GWT JAR
52 jar -cf dist/dygraph-gwt.jar -C gwt org
53
54 # Remove temp files.
55 rm dist/dygraph.tmp.js
56 rm dist/dygraph.tmp.js.map