X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=scripts%2Fbuild.sh;fp=scripts%2Fbuild.sh;h=9374a9c0b077f8bd3acb3bc93b63069f91e346d1;hb=ce31caf22475e3e1fd6d9fea192d61ff4fcd7fac;hp=0000000000000000000000000000000000000000;hpb=a4c3ece0a11e4e5c4f1f51a8bc8b7878d34ee052;p=dygraphs.git diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..9374a9c --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# This generates: +# - dist/dygraph.js +# - dist/dygraph.js.map +# - dist/dygraph.min.js +# - dist/dygraph.min.js.map +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 2014 Dan Vanderkam (danvdk@gmail.com) 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 + +# Copy to the old location +cp dist/dygraph.min.js dist/dygraph-combined.js + +# Build GWT JAR +jar -cf dist/dygraph-gwt.jar -C gwt org + +# Remove temp files. +rm dist/dygraph.tmp.js +rm dist/dygraph.tmp.js.map