mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 14:19:58 +00:00
Prod packaging POC
This commit is contained in:
parent
e90a72a5f1
commit
6726b4704b
19
electron.js
19
electron.js
@ -1,4 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
// Don't npm install this (it breaks). Rely on the global one.
|
||||
const electron = require('electron');
|
||||
@ -18,21 +17,21 @@ app.on('window-all-closed', function () {
|
||||
|
||||
app.on('ready', function () {
|
||||
mainWindow = new BrowserWindow({
|
||||
width: IS_DEV ? 1600 : 1200,
|
||||
height: 800,
|
||||
minHeight: 500,
|
||||
width: 1200,
|
||||
height: 600,
|
||||
minHeight: 400,
|
||||
minWidth: 500,
|
||||
acceptFirstMouse: true
|
||||
// titleBarStyle: IS_MAC ? 'hidden-inset' : 'default'
|
||||
});
|
||||
|
||||
// and load the electron.html of the app.
|
||||
mainWindow.loadURL(`file://${__dirname}/app/electron.html`);
|
||||
// and load the app.html of the app.
|
||||
mainWindow.loadURL(`file://${__dirname}/app/app.html`);
|
||||
|
||||
// Open the DevTools.
|
||||
if (IS_DEV) {
|
||||
mainWindow.webContents.openDevTools();
|
||||
}
|
||||
// Open the DevTools.
|
||||
// if (IS_DEV) {
|
||||
// mainWindow.webContents.openDevTools();
|
||||
// }
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', function () {
|
||||
|
@ -60,7 +60,7 @@
|
||||
"hot-server": "node ./webpack/server.js",
|
||||
"dev": "concurrently --kill-others \"npm run hot-server\" \"npm run start-hot\"",
|
||||
"test": "jest $@",
|
||||
"package": "npm test && webpack --config webpack/prod.config.js"
|
||||
"package": "./scripts/package"
|
||||
},
|
||||
"jest": {
|
||||
"unmockedModulePathPatterns": [
|
||||
|
5
scripts/package
Executable file
5
scripts/package
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
#? Package the app
|
||||
|
||||
webpack --config webpack/prod.config.js
|
||||
cp -r node_modules electron.js package.json dist/
|
@ -1,6 +1,5 @@
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var webpackTargetElectronRenderer = require('webpack-target-electron-renderer');
|
||||
|
||||
var config = {
|
||||
target: 'web',
|
||||
@ -8,10 +7,10 @@ var config = {
|
||||
context: path.join(__dirname, '../app'),
|
||||
entry: [
|
||||
'./index.js',
|
||||
'./electron.html'
|
||||
'./app.html'
|
||||
],
|
||||
output: {
|
||||
path: path.join(__dirname, '../dist'),
|
||||
path: path.join(__dirname, '../dist/app'),
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
module: {
|
||||
@ -76,5 +75,5 @@ var config = {
|
||||
]
|
||||
};
|
||||
|
||||
config.target = webpackTargetElectronRenderer(config);
|
||||
config.target = 'electron';
|
||||
module.exports = config;
|
||||
|
@ -2,6 +2,4 @@ var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var base = require('./base.config');
|
||||
|
||||
base.output.path = path.join(base.output.path, '/prod');
|
||||
|
||||
module.exports = base;
|
||||
|
Loading…
Reference in New Issue
Block a user