Add minify step to prod deployment #1

Merged
hardi merged 1 commits from task/minified-ng-output into master 2017-07-29 11:48:54 +02:00
4 changed files with 18 additions and 6 deletions

11
minify.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# array of files to minify
FILES=(inline main polyfills scripts styles vendor)
OPTIONS="-c toplevel,dead_code=true,unused=true"
for i in "${FILES[@]}"
do
echo "minify ${i} ..."
$(npm bin)/uglifyjs public/${i}.bundle.js ${OPTIONS} -o public/${i}.bundle.js
done

View File

@ -7,7 +7,8 @@
"start": "npm run deploy-static-prod && npm start --prefix ./api", "start": "npm run deploy-static-prod && npm start --prefix ./api",
"dev": "npm run deploy-static && npm run dev --prefix ./api", "dev": "npm run deploy-static && npm run dev --prefix ./api",
"deploy-static": "cd ./static && $(npm bin)/ng build && ln -s ../api/resource/ ../public/resource", "deploy-static": "cd ./static && $(npm bin)/ng build && ln -s ../api/resource/ ../public/resource",
"deploy-static-prod": "cd ./static && $(npm bin)/ng build --env=prod && ln -s ../api/resource/ ../public/resource", "deploy-static-prod": "cd ./static && $(npm bin)/ng build --env=prod && ln -s ../api/resource/ ../public/resource && cd .. && npm run deploy-minify",
"deploy-minify": "./minify.sh",
"postinstall": "npm install --prefix ./static && npm install --prefix ./api", "postinstall": "npm install --prefix ./static && npm install --prefix ./api",
"mongodb": "mkdir -p mongodb-data && mongod --dbpath ./mongodb-data", "mongodb": "mkdir -p mongodb-data && mongod --dbpath ./mongodb-data",
"test": "npm test --prefix ./api", "test": "npm test --prefix ./api",

View File

@ -1,10 +1,10 @@
{ {
"extends": "../tsconfig.json", "extends": "../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"lib": [ "lib": [
"es2016", "es2016",
"dom" "dom"
], ],
"outDir": "../out-tsc/app", "outDir": "../out-tsc/app",
"target": "es5", "target": "es5",
"module": "es2015", "module": "es2015",

View File

@ -2,7 +2,7 @@
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"sourceMap": true, "sourceMap": false,
"declaration": false, "declaration": false,
"moduleResolution": "node", "moduleResolution": "node",
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,