forked from danvk/dygraphs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·57 lines (46 loc) · 1.43 KB
/
build.sh
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
#!/bin/bash
# This generates everything under dist:
# bundled JS, minified JS, minified CSS and source maps.
set -o errexit
mkdir -p dist
# Create dist/dygraph.js
browserify \
-v \
-t babelify \
-t [ envify --NODE_ENV development ] \
--debug \
--standalone Dygraph \
src/dygraph.js \
> dist/dygraph.tmp.js
# Create dist/dygraph.js.map
cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.js.map > dist/dygraph.js
# Create "production" bundle for minification
browserify \
-v \
-t babelify \
-t [ envify --NODE_ENV production ] \
--debug \
--standalone Dygraph \
src/dygraph.js \
> dist/dygraph.tmp.js
# Create dist/dygraph.tmp.js.map
cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.tmp.js.map > /dev/null
header='/*! @license Copyright 2017 Dan Vanderkam ([email protected]) MIT-licensed (http://opensource.org/licenses/MIT) */'
# Create dist/dygraph.js.min{,.map}
uglifyjs --compress --mangle \
--preamble "$header" \
--in-source-map dist/dygraph.tmp.js.map \
--source-map-include-sources \
--source-map dist/dygraph.min.js.map \
-o dist/dygraph.min.js \
dist/dygraph.tmp.js
# Build GWT JAR
jar -cf dist/dygraph-gwt.jar -C gwt org
# Minify CSS
cp css/dygraph.css dist/
cleancss css/dygraph.css -o dist/dygraph.min.css --source-map --source-map-inline-sources
# Build ES5-compatible distribution
babel src -d src-es5 --compact false
# Remove temp files.
rm dist/dygraph.tmp.js
rm dist/dygraph.tmp.js.map