build: Minify the JS

This commit is contained in:
Alexander Polynomdivision 2018-09-15 14:45:38 +02:00
parent 7e9c1463f5
commit 74904a2be5
3 changed files with 18 additions and 12 deletions

13
build.sh Normal file
View File

@ -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

16
package-lock.json generated
View File

@ -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": {

View File

@ -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"
},