From 12a864c709aba73f82523f251e566ce94f889ff4 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Thu, 2 Jan 2020 14:26:14 +0900 Subject: [PATCH] package structure is changed --- .../build/win/nsis/installer-for-.net45.nsh | 1 + config/main.webpack.config.ts | 6 ++- electron-builder.json | 11 ----- .../src/app/AppWindow.ts | 2 +- .../ucap-webmessenger-electron/src/index.ts | 4 +- .../src/util/root.ts | 2 +- package-lock.json | 47 ++++++++++++++++++- package.json | 9 +++- .../src/app/app-translate.module.ts | 2 +- 9 files changed, 63 insertions(+), 21 deletions(-) diff --git a/config/build/win/nsis/installer-for-.net45.nsh b/config/build/win/nsis/installer-for-.net45.nsh index 512ffd39..8a411fa5 100644 --- a/config/build/win/nsis/installer-for-.net45.nsh +++ b/config/build/win/nsis/installer-for-.net45.nsh @@ -1,4 +1,5 @@ Function CheckAndDownloadDotNet45 + # Let's see if the user has the .NET Framework 4.5 installed on their system or not # Remember: you need Vista SP2 or 7 SP1. It is built in to Windows 8, and not needed # In case you're wondering, running this code on Windows 8 will correctly return is_equal diff --git a/config/main.webpack.config.ts b/config/main.webpack.config.ts index 45265e43..a264061e 100644 --- a/config/main.webpack.config.ts +++ b/config/main.webpack.config.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import { CleanWebpackPlugin } from 'clean-webpack-plugin'; import * as CopyWebpackPlugin from 'copy-webpack-plugin'; +import * as UglifyJsPlugin from 'uglifyjs-webpack-plugin'; import * as webpack from 'webpack'; import * as nodeExternals from 'webpack-node-externals'; import { getEnviroments } from './enviroment'; @@ -24,9 +25,10 @@ const mainConfig: webpack.Configuration = { }, target: 'electron-main', mode: enviroments.__DEV__ ? 'development' : 'production', - devtool: 'source-map', + devtool: enviroments.__DEV__ ? 'source-map' : undefined, optimization: { - noEmitOnErrors: true + noEmitOnErrors: true, + minimizer: [new UglifyJsPlugin()] }, externals, output: { diff --git a/electron-builder.json b/electron-builder.json index d8f9c721..32630d45 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -23,20 +23,9 @@ "!**/.awcache", "!**/.vscode", "!config/", - "!dist/", "!docker/", "!tsconfig.json", "!tslint.json", - { - "filter": ["**/*"], - "from": "./dist/ucap-webmessenger-app/", - "to": "./renderer/" - }, - { - "filter": ["**/*"], - "from": "./dist/ucap-webmessenger-electron/", - "to": "./electron/" - }, { "filter": ["**/*"], "from": "./config/build/${os}/icon/daesang/", diff --git a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts index 8b7abfae..ab156b11 100644 --- a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts +++ b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts @@ -165,7 +165,7 @@ export class AppWindow { } else { this.window.loadURL( url.format({ - pathname: path.join(__dirname, '..', 'renderer/index.html'), + pathname: path.join(__dirname, '..', 'ucap-webmessenger-app/index.html'), protocol: 'file:', slashes: true }) diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index d2a8a0e2..6169024d 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -55,7 +55,7 @@ const appIconPath = __LINUX__ 'config/build/linux/icon/daesang/', '256x256.png' ) - : path.join(__dirname, '..', '/assets/icon/', '256x256.png') + : path.join(__dirname, '..', '..', '/assets/icon/', '256x256.png') : __DEV__ ? path.join( __dirname, @@ -63,7 +63,7 @@ const appIconPath = __LINUX__ 'config/build/win/icon/daesang/', '16x16.ico' ) - : path.join(__dirname, '..', '/assets/icon/', '16x16.ico'); + : path.join(__dirname, '..', '..', '/assets/icon/', '16x16.ico'); let appWindow: AppWindow | null = null; let appTray: Tray | null = null; diff --git a/electron-projects/ucap-webmessenger-electron/src/util/root.ts b/electron-projects/ucap-webmessenger-electron/src/util/root.ts index ce534375..32fdd3f6 100644 --- a/electron-projects/ucap-webmessenger-electron/src/util/root.ts +++ b/electron-projects/ucap-webmessenger-electron/src/util/root.ts @@ -3,7 +3,7 @@ import * as path from 'path'; // tslint:disable-next-line: variable-name const _root = __DEV__ ? path.resolve(__dirname, '..', '..') - : path.resolve(__dirname, '..'); + : path.resolve(__dirname, '..', '..'); export function root(...paths: string[]) { const args = Array.prototype.slice.call(paths, 0); diff --git a/package-lock.json b/package-lock.json index 517d4c6b..2fe9b8a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2488,6 +2488,15 @@ } } }, + "@types/uglifyjs-webpack-plugin": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@types/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.1.0.tgz", + "integrity": "sha512-QoCJYq+zNtuvKw4nutaIxQXKBpvc0Hd6U7BUVi2Cest2FrkGTYDBD6YpSq5d9IHjo94SjXk+6KDqQVOcEzFJZA==", + "dev": true, + "requires": { + "@types/webpack": "*" + } + }, "@types/webpack": { "version": "4.39.5", "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.39.5.tgz", @@ -14263,7 +14272,6 @@ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", "dev": true, - "optional": true, "requires": { "commander": "~2.20.0", "source-map": "~0.6.1" @@ -14273,8 +14281,43 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "uglifyjs-webpack-plugin": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.2.0.tgz", + "integrity": "sha512-mHSkufBmBuJ+KHQhv5H0MXijtsoA1lynJt1lXOaotja8/I0pR4L9oGaPIZw+bQBOFittXZg9OC1sXSGO9D9ZYg==", + "dev": true, + "requires": { + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^1.7.0", + "source-map": "^0.6.1", + "uglify-js": "^3.6.0", + "webpack-sources": "^1.4.0", + "worker-farm": "^1.7.0" + }, + "dependencies": { + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", "dev": true, - "optional": true + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, diff --git a/package.json b/package.json index cb1df3fc..e8f71697 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,11 @@ { "name": "ucap-webmessenger", "version": "0.0.0", + "author": { + "name": "LG CNS", + "email": "lgucap@lgcns.com" + }, + "description": "Daesang Client for UCap M Messenger", "scripts": { "postinstall": "electron-builder install-app-deps", "ng": "ng", @@ -89,6 +94,7 @@ "@types/moment-timezone": "^0.5.12", "@types/node": "^10.14.22", "@types/semver": "^6.0.2", + "@types/uglifyjs-webpack-plugin": "^1.1.0", "@types/webpack": "^4.39.5", "@types/webpack-merge": "^4.1.5", "@types/webpack-node-externals": "^1.6.3", @@ -138,6 +144,7 @@ "tslib": "^1.10.0", "tslint": "~5.15.0", "typescript": "~3.5.3", + "uglifyjs-webpack-plugin": "^2.2.0", "wait-on": "^3.3.0", "web-animations-js": "^2.3.2", "webpack": "4.39.2", @@ -145,5 +152,5 @@ "webpack-node-externals": "^1.7.2", "zone.js": "~0.9.1" }, - "main": "./electron/main.js" + "main": "./dist/ucap-webmessenger-electron/main.js" } diff --git a/projects/ucap-webmessenger-app/src/app/app-translate.module.ts b/projects/ucap-webmessenger-app/src/app/app-translate.module.ts index 531600ca..9034d687 100644 --- a/projects/ucap-webmessenger-app/src/app/app-translate.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app-translate.module.ts @@ -19,7 +19,7 @@ export function createTranslateLoader(nativeService: NativeService) { break; case NativeType.Electron: prefix = environment.production - ? '/renderer/assets/i18n/' + ? '/dist/ucap-webmessenger-app/assets/i18n/' : '/projects/ucap-webmessenger-app/src/assets/i18n/'; break;