This commit is contained in:
crusader 2018-10-04 02:20:12 +09:00
parent 258f77abe3
commit 95e68aaec9
5 changed files with 34 additions and 60 deletions

View File

@ -7,20 +7,20 @@ const projectRoot = path.dirname(__dirname, '..');
const channel = getReleaseChannel(); const channel = getReleaseChannel();
const s = JSON.stringify;
function getReplacements() { function getReplacements() {
return { return {
__DARWIN__: process.platform === 'darwin', __DARWIN__: process.platform === 'darwin',
__WIN32__: process.platform === 'win32', __WIN32__: process.platform === 'win32',
__LINUX__: process.platform === 'linux', __LINUX__: process.platform === 'linux',
__DEV__: channel === 'development', __DEV__: channel === 'development',
__RELEASE_CHANNEL__: s(channel), __RELEASE_CHANNEL__: JSON.stringify(channel),
__UPDATES_URL__: s(getUpdatesURL()), __UPDATES_URL__: JSON.stringify(getUpdatesURL()),
'process.platform': s(process.platform), 'process.platform': JSON.stringify(process.platform),
'process.env.NODE_ENV': s(process.env.NODE_ENV || 'development'), 'process.env.NODE_ENV': JSON.stringify(
'process.env.TEST_ENV': s(process.env.TEST_ENV), process.env.NODE_ENV || 'development'
} ),
'process.env.TEST_ENV': JSON.stringify(process.env.TEST_ENV)
};
} }
exports.getReplacements = getReplacements; exports.getReplacements = getReplacements;

Binary file not shown.

View File

@ -13,8 +13,7 @@ const replacements = getReplacements();
const EVENT = process.env.npm_lifecycle_event || ''; const EVENT = process.env.npm_lifecycle_event || '';
const PROD = EVENT.includes('prod'); const PROD = EVENT.includes('prod');
module.exports = (function() {
module.exports = function () {
const tsConfigBase = './src/tsconfig.electron.json'; const tsConfigBase = './src/tsconfig.electron.json';
const atlConfig = { const atlConfig = {
@ -27,20 +26,17 @@ module.exports = function () {
config.devtool = PROD ? false : 'cheap-module-source-map'; config.devtool = PROD ? false : 'cheap-module-source-map';
config.externals = [nodeExternals()]; config.externals = [nodeExternals()];
config.entry = { config.entry = {
'index': root('src', 'electron', 'main.ts') index: root('src', 'electron', 'main.ts')
}; };
config.output = { config.output = {
path: PROD ? root('build', 'dist') : root('build', 'dev'), path: PROD ? root('build', 'dist') : root('build', 'dev'),
filename: '[name].js', filename: '[name].js',
sourceMapFilename: '[file].map', sourceMapFilename: '[file].map'
}; };
config.resolve = { config.resolve = {
extensions: ['.ts', '.tsx', '.mjs', '.js'], extensions: ['.ts', '.tsx', '.mjs', '.js'],
modules: [ modules: [root(), 'node_modules']
root(), };
'node_modules',
],
}
config.module = { config.module = {
rules: [ rules: [
{ {
@ -59,17 +55,14 @@ module.exports = function () {
}; };
config.plugins = [ config.plugins = [
PROD ? new webpack.NoEmitOnErrorsPlugin() : null, PROD ? new webpack.NoEmitOnErrorsPlugin() : null,
// PROD ? new CopyWebpackPlugin(
// [
// 'config/package.json'
// ]
// ) : null,
new webpack.DefinePlugin( new webpack.DefinePlugin(
Object.assign({}, replacements, { Object.assign({}, replacements, {
__PROCESS_KIND__: JSON.stringify('main'), __PROCESS_KIND__: JSON.stringify('main')
}) })
), ),
PROD ? null : new ElectronConnectWebpackPlugin({ PROD
? null
: new ElectronConnectWebpackPlugin({
path: root('build', 'dev'), path: root('build', 'dev'),
stopOnClose: true, stopOnClose: true,
logLevel: 0 logLevel: 0
@ -77,5 +70,4 @@ module.exports = function () {
].filter(plugin => plugin !== null); ].filter(plugin => plugin !== null);
return config; return config;
})();
}();

View File

@ -5,7 +5,7 @@
"extraMetadata": { "extraMetadata": {
"name": "overflow-network-scanner" "name": "overflow-network-scanner"
}, },
"asar": true, "asar": false,
"compression": "normal", "compression": "normal",
"npmRebuild": false, "npmRebuild": false,
"npmSkipBuildFromSource": false, "npmSkipBuildFromSource": false,
@ -17,19 +17,12 @@
"files": [ "files": [
"packages.json", "packages.json",
{ {
"filter": [ "filter": ["**/*", "!*.ts", "!*.scss", "!yarn.lock"],
"**/*",
"!*.ts",
"!*.scss",
"!yarn.lock"
],
"from": "./build/dist/", "from": "./build/dist/",
"to": "." "to": "."
}, },
{ {
"filter": [ "filter": ["**/*"],
"**/*"
],
"from": "config/build/${os}/icon/", "from": "config/build/${os}/icon/",
"to": "./assets/image/icon/" "to": "./assets/image/icon/"
} }
@ -44,10 +37,7 @@
"target": [ "target": [
{ {
"target": "deb", "target": "deb",
"arch": [ "arch": ["ia32", "x64"]
"ia32",
"x64"
]
} }
], ],
"category": "Network;Monitor;", "category": "Network;Monitor;",
@ -64,18 +54,13 @@
} }
}, },
"deb": { "deb": {
"depends": [ "depends": ["libpcap0.8"],
"libpcap0.8"
],
"afterInstall": "config/build/linux/debian/after-install.tpl" "afterInstall": "config/build/linux/debian/after-install.tpl"
}, },
"mac": { "mac": {
"target": [ "target": ["dmg"],
"dmg"
],
"category": "public.app-category.utilities", "category": "public.app-category.utilities",
"minimumSystemVersion": "10.12.0", "minimumSystemVersion": "10.12.0",
"extendInfo": "config/build/mac/Info.plist",
"icon": "config/build/mac/icon/overflow_1024.icns", "icon": "config/build/mac/icon/overflow_1024.icns",
"extraResources": [ "extraResources": [
{ {
@ -87,8 +72,8 @@
"dmg": { "dmg": {
"background": "config/build/mac/dmg/background.png", "background": "config/build/mac/dmg/background.png",
"icon": "config/build/mac/dmg/icon.icns", "icon": "config/build/mac/dmg/icon.icns",
"iconSize": 80, "iconSize": 120,
"iconTextSize": 12, "iconTextSize": 18,
"contents": [ "contents": [
{ {
"x": 480, "x": 480,
@ -107,10 +92,7 @@
"target": [ "target": [
{ {
"target": "nsis", "target": "nsis",
"arch": [ "arch": ["x64", "ia32"]
"x64",
"ia32"
]
} }
], ],
"legalTrademarks": "overFlow", "legalTrademarks": "overFlow",