diff --git a/config/webpack.config.main.js b/config/webpack.config.main.js index 6c1d618..0c0c2b1 100644 --- a/config/webpack.config.main.js +++ b/config/webpack.config.main.js @@ -62,7 +62,7 @@ module.exports = function () { __PROCESS_KIND__: JSON.stringify('main'), }) ), - new ElectronConnectWebpackPlugin({ + PROD ? null : new ElectronConnectWebpackPlugin({ path: root('build', 'dev'), stopOnClose: true, logLevel: 0 diff --git a/config/webpack.config.renderer.js b/config/webpack.config.renderer.js index c67bb43..a3a4d84 100644 --- a/config/webpack.config.renderer.js +++ b/config/webpack.config.renderer.js @@ -4,11 +4,21 @@ const util = require('util'); const webpack = require('webpack'); const { getReplacements } = require('./app-info'); +const { hasProcessFlag, root } = require('./helpers.js'); const replacements = getReplacements(); +const EVENT = process.env.npm_lifecycle_event || ''; +const PROD = EVENT.includes('prod'); + module.exports = function (config) { config.target = 'electron-renderer'; + // config.output = { + // path: PROD ? root('build', 'dist') : root('build', 'dev'), + // filename: '[name].js', + // sourceMapFilename: '[file].map', + // }; + config.plugins.push( new webpack.DefinePlugin( @@ -18,10 +28,6 @@ module.exports = function (config) { ) ); - - // console.log(config.module); - // console.log(util.inspect(config.module, {showHidden: false, depth: null})); - var json = util.inspect(config, { showHidden: false, depth: null }); fse.writeFileSync('webpack.js', json, 'utf8'); diff --git a/electron-builder.json b/electron-builder.json index 47e94e7..5b18b17 100644 --- a/electron-builder.json +++ b/electron-builder.json @@ -1,7 +1,7 @@ { "appId": "com.loafle.overflow.scanner", "productName": "overFlow Network Scanner", - "copyright": "Copyright © 2015 LOAFLE", + "copyright": "Copyright © 2016 LOAFLE", "directories": { "buildResources": "electron/" }, @@ -63,6 +63,12 @@ }, "deb": { "depends": [ + "gconf2", + "gconf-service", + "libnotify4", + "libappindicator1", + "libxtst6", + "libnss3", "libpcap" ], "afterInstall": "config/build/linux/after-install.tpl", diff --git a/package.json b/package.json index c028e68..b0a726b 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,8 @@ "start:hmr": "ng serve --configuration hmr", "start:electron:hmr": "npm-run-all -p start:hmr wait-on:build:main:dev", "build": "ng build", + "build:renderer:dev": "ng build", + "build:renderer:prod": "ng build --aot", "build:main:dev": "webpack --config config/webpack.config.main.js --progress --profile", "build:main:prod": "webpack --config config/webpack.config.main.js --progress --profile", "test": "ng test", @@ -97,4 +99,4 @@ "webpack-node-externals": "^1.7.2", "zone.js": "^0.8.26" } -} +} \ No newline at end of file diff --git a/src/electron/app-window.ts b/src/electron/app-window.ts index 00a1d03..10d4269 100644 --- a/src/electron/app-window.ts +++ b/src/electron/app-window.ts @@ -175,14 +175,17 @@ export class AppWindow { this.window.on('blur', () => this.window.webContents.send('blur')); registerWindowStateChangedEvents(this.window); - // this.window.loadURL(encodePathAsUrl(__dirname, 'index.html')); - const indexUrl = URL.format({ - pathname: path.join('//localhost:4200'), - protocol: 'http:', - slashes: true - }); - this.window.loadURL(indexUrl); + if (__DEV__) { + const indexUrl = URL.format({ + pathname: path.join('//localhost:4200'), + protocol: 'http:', + slashes: true + }); + this.window.loadURL(indexUrl); + } else { + this.window.loadURL(encodePathAsUrl(__dirname, 'index.html')); + } } /** @@ -287,7 +290,7 @@ export class AppWindow { d.showCertificateTrustDialog( this.window, { certificate, message }, - () => {} + () => { } ); }