diff --git a/minify.sh b/minify.sh new file mode 100755 index 0000000..64f59f6 --- /dev/null +++ b/minify.sh @@ -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 diff --git a/package.json b/package.json index ec4f66a..1c47789 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "start": "npm run deploy-static-prod && npm start --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-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", "mongodb": "mkdir -p mongodb-data && mongod --dbpath ./mongodb-data", "test": "npm test --prefix ./api", diff --git a/static/src/app/models/model-interfaces.ts b/static/src/app/models/model-interfaces.ts index 5b0a706..a3d5dd2 100644 --- a/static/src/app/models/model-interfaces.ts +++ b/static/src/app/models/model-interfaces.ts @@ -11,7 +11,7 @@ export interface User { _id?: string; boardUserId?: number; username?: string; - squad?: Squad; + squad?: any; //Squad or string rank?: Rank; awards?: Award[]; } @@ -54,7 +54,7 @@ export interface Rank { export interface Award { _id?: string, userId: string, - decorationId?: Decoration; + decorationId?: any; //Decoration or string reason?: string; proposer?: AppUser; date?: number; // since Date.now() returns a number diff --git a/static/src/app/request/award/req-award.component.ts b/static/src/app/request/award/req-award.component.ts index 3d213fe..6935187 100644 --- a/static/src/app/request/award/req-award.component.ts +++ b/static/src/app/request/award/req-award.component.ts @@ -79,7 +79,7 @@ export class RequestAwardComponent { addAwarding(previewImage, descriptionField) { if (this.decoration._id && this.reason.length > 0) { - const award = { + const award : Award = { "userId": this.user._id, "decorationId": this.decoration._id, "reason": this.reason, diff --git a/static/src/app/users/edit-user/edit-user.component.html b/static/src/app/users/edit-user/edit-user.component.html index 5e18fee..07c609b 100644 --- a/static/src/app/users/edit-user/edit-user.component.html +++ b/static/src/app/users/edit-user/edit-user.component.html @@ -4,7 +4,7 @@