consolidating scripts
[dygraphs.git] / scripts / build.sh
CommitLineData
514a10f3
DV
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
7set -o errexit
8
9mkdir -p dist
10
11# Create dist/dygraph.js
12browserify \
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
22cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.js.map > dist/dygraph.js
23
24# Create "production" bundle for minification
25browserify \
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
35cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.tmp.js.map > /dev/null
36
37# Create dist/dygraph.js.min{,.map}
38uglifyjs --compress --mangle \
39 --in-source-map dist/dygraph.tmp.js.map \
40 --source-map-include-sources \
41 --source-map dist/dygraph.min.js.map \
42 -o dist/dygraph.min.js \
43 dist/dygraph.tmp.js
44
45# Copy to the old location
46cp dist/dygraph.min.js dist/dygraph-combined.js
47
48# Build GWT JAR
49jar -cf dist/dygraph-gwt.jar -C gwt org
50
51# Remove temp files.
52rm dist/dygraph.tmp.js
53rm dist/dygraph.tmp.js.map