compile-minified.sh 778 B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. #
  3. # This file builds all of the Javascript into a minified "hermetic" bundle.js
  4. # file, which is written out into the same directory as this script.
  5. #
  6. # This script takes no arguments. See README.md for more information.
  7. viz_path="$(readlink -f "$(dirname "$0")")"
  8. (
  9. cd "${viz_path}"
  10. docker build -t dragnn-viz-dev .
  11. )
  12. # Webpack is configured to write the bundle.js back out to code/src, which will
  13. # end up writing it to the Docker volume (and hence to the host filesystem).
  14. docker run --rm -ti \
  15. -v "${viz_path}:/code/src" \
  16. dragnn-viz-dev \
  17. ./node_modules/.bin/webpack --optimize-minimize
  18. mv "${viz_path}/bundle.js" "${viz_path}/viz.min.js"
  19. gzip -9 --force "${viz_path}/viz.min.js"
  20. echo "Compressed size: $(wc -c < "${viz_path}/viz.min.js.gz") bytes"