Prod packaging POC

This commit is contained in:
Gregory Schier 2016-04-18 23:05:55 -07:00
parent e90a72a5f1
commit 6726b4704b
6 changed files with 18 additions and 17 deletions

View File

@ -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();
}
// if (IS_DEV) {
// mainWindow.webContents.openDevTools();
// }
// Emitted when the window is closed.
mainWindow.on('closed', function () {

View File

@ -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
View 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/

View File

@ -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;

View File

@ -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;