From 74904a2be538c415936f9c079b562a8c1012d985 Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Sat, 15 Sep 2018 14:45:38 +0200 Subject: [PATCH] build: Minify the JS --- build.sh | 13 +++++++++++++ package-lock.json | 16 ++++------------ package.json | 1 + 3 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..cb06283 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -x +# Build the App +./node_modules/.bin/parcel build + +# Minify the JS +if [ ! -d ./dist/minified_js ]; then + mkdir ./dist/minified_js +fi +for file in ./dist/*.js; do + echo "== MINIFYING $file ==" + ./node_modules/.bin/uglifyjs --mangle --compress -o "./dist/minified_js/$(basename $file)" -- $file +done diff --git a/package-lock.json b/package-lock.json index d5e8a7d..a6b163d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12333,21 +12333,13 @@ "dev": true }, "uglify-js": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.7.tgz", - "integrity": "sha512-J0M2i1mQA+ze3EdN9SBi751DNdAXmeFLfJrd/MDIkRc3G3Gbb9OPVSx7GIQvVwfWxQARcYV2DTxIkMyDAk3o9Q==", + "version": "3.4.9", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", + "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", "dev": true, "requires": { - "commander": "~2.16.0", + "commander": "~2.17.1", "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz", - "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", - "dev": true - } } }, "uglifyjs-webpack-plugin": { diff --git a/package.json b/package.json index 588a90d..5a6531c 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "parcel-bundler": "^1.9.7", "ts-jest": "^23.1.4", "typescript": "^2.9.2", + "uglify-js": "^3.4.9", "webpack": "4.17.1", "webpack-cli": "3.1.0" },