X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=scripts%2Fbuild.sh;h=ebdd1d42551bfec912e91b5af3bfb4da9f3228f0;hb=00eebc92ec7d1846599bf233dbc63b9ea3ac3095;hp=d9ea2e2254394dff8eea7fba016132c07d684894;hpb=514a10f302043e48459a79806775b6925dc9a7b5;p=dygraphs.git diff --git a/scripts/build.sh b/scripts/build.sh index d9ea2e2..ebdd1d4 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,6 @@ #!/bin/bash -# This generates: -# - dist/dygraph.js -# - dist/dygraph.js.map -# - dist/dygraph.min.js -# - dist/dygraph.min.js.map +# This generates everything under dist: +# bundled JS, minified JS, minified CSS and source maps. set -o errexit mkdir -p dist @@ -34,20 +31,27 @@ browserify \ # 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 (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 +# 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