Bug fix for dygraph point selection touch event.
[dygraphs.git] / scripts / build.sh
CommitLineData
514a10f3 1#!/bin/bash
fd6b8dad
DV
2# This generates everything under dist:
3# bundled JS, minified JS, minified CSS and source maps.
514a10f3
DV
4set -o errexit
5
6mkdir -p dist
7
8# Create dist/dygraph.js
9browserify \
10 -v \
11 -t babelify \
12 -t [ envify --NODE_ENV development ] \
13 --debug \
14 --standalone Dygraph \
15 src/dygraph.js \
16 > dist/dygraph.tmp.js
17
18# Create dist/dygraph.js.map
19cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.js.map > dist/dygraph.js
20
21# Create "production" bundle for minification
22browserify \
23 -v \
24 -t babelify \
25 -t [ envify --NODE_ENV production ] \
26 --debug \
27 --standalone Dygraph \
28 src/dygraph.js \
29 > dist/dygraph.tmp.js
30
31# Create dist/dygraph.tmp.js.map
32cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.tmp.js.map > /dev/null
33
627e054d 34header='/*! @license Copyright 2017 Dan Vanderkam (danvdk@gmail.com) MIT-licensed (http://opensource.org/licenses/MIT) */'
ca8c8583 35
514a10f3
DV
36# Create dist/dygraph.js.min{,.map}
37uglifyjs --compress --mangle \
ca8c8583 38 --preamble "$header" \
514a10f3
DV
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
514a10f3
DV
45# Build GWT JAR
46jar -cf dist/dygraph-gwt.jar -C gwt org
47
fd6b8dad
DV
48# Minify CSS
49cp css/dygraph.css dist/
50cleancss css/dygraph.css -o dist/dygraph.min.css --source-map --source-map-inline-sources
51
52# Build ES5-compatible distribution
53babel src -d src-es5 --compact false
54
514a10f3
DV
55# Remove temp files.
56rm dist/dygraph.tmp.js
57rm dist/dygraph.tmp.js.map