Make production build work, for the most part
This commit is contained in:
parent
e6c3b5f9ea
commit
63e07cd42f
@ -13,6 +13,9 @@
|
|||||||
"build/**/*",
|
"build/**/*",
|
||||||
"node_modules/**/*"
|
"node_modules/**/*"
|
||||||
],
|
],
|
||||||
|
"directories": {
|
||||||
|
"buildResources": "assets"
|
||||||
|
},
|
||||||
"mac": {
|
"mac": {
|
||||||
"category": "public.app-category.photography",
|
"category": "public.app-category.photography",
|
||||||
"icon": "assets/icons/FilmExif.icns",
|
"icon": "assets/icons/FilmExif.icns",
|
||||||
@ -80,7 +83,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "set NODE_ENV=production && rollup --config rollup.prod.js",
|
"build": "set NODE_ENV=production && rollup --config rollup.prod.js",
|
||||||
"dist": "yarn run build && build",
|
"predist": "yarn run build",
|
||||||
|
"dist": "build",
|
||||||
"electron-start": "set NODE_ENV=development && node src/electron/wait-inferno",
|
"electron-start": "set NODE_ENV=development && node src/electron/wait-inferno",
|
||||||
"electron": "electron .",
|
"electron": "electron .",
|
||||||
"fix": "eslint --fix src/**/*.js",
|
"fix": "eslint --fix src/**/*.js",
|
||||||
|
15
public/index-prod.html
Normal file
15
public/index-prod.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||||
|
<link rel="shortcut icon" href="./favicon.ico"/>
|
||||||
|
<link rel="stylesheet" href="./css/bootstrap.css"/>
|
||||||
|
<link rel="stylesheet" href="./css/app.css"/>
|
||||||
|
<title>Inferno App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<film-exif id="app"></film-exif>
|
||||||
|
<script src="./bundle.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -2,6 +2,7 @@ import baseConfig from './rollup.config';
|
|||||||
import filesize from 'rollup-plugin-filesize';
|
import filesize from 'rollup-plugin-filesize';
|
||||||
import replace from 'rollup-plugin-replace';
|
import replace from 'rollup-plugin-replace';
|
||||||
import { terser } from 'rollup-plugin-terser';
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
import copy from 'rollup-plugin-copy';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
...baseConfig,
|
...baseConfig,
|
||||||
@ -10,6 +11,12 @@ export default {
|
|||||||
'process.env.NODE_ENV': "'production'",
|
'process.env.NODE_ENV': "'production'",
|
||||||
}),
|
}),
|
||||||
...baseConfig.plugins,
|
...baseConfig.plugins,
|
||||||
|
copy({
|
||||||
|
'public/index-prod.html': 'build/index.html',
|
||||||
|
'public/favicon.ico': 'build/favicon.ico',
|
||||||
|
'public/css/bootstrap.css': 'build/css/bootstrap.css',
|
||||||
|
'public/css/app.css': 'build/css/app.css',
|
||||||
|
}),
|
||||||
terser(),
|
terser(),
|
||||||
filesize(),
|
filesize(),
|
||||||
],
|
],
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import {app, BrowserWindow} from 'electron';
|
import {app, BrowserWindow} from 'electron';
|
||||||
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
|
|
||||||
import log from 'electron-log';
|
import log from 'electron-log';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import url from 'url';
|
|
||||||
|
|
||||||
log.transports.file.level = false;
|
log.transports.file.level = false;
|
||||||
log.transports.console.level = 'info';
|
log.transports.console.level = 'info';
|
||||||
@ -15,34 +13,24 @@ let mainWindow;
|
|||||||
|
|
||||||
const createWindow = () => {
|
const createWindow = () => {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
if (DEV_MODE) {
|
mainWindow = new BrowserWindow({
|
||||||
mainWindow = new BrowserWindow();
|
webPreferences: {
|
||||||
} else {
|
contextIsolation: true,
|
||||||
mainWindow = new BrowserWindow({
|
nodeIntegration: false,
|
||||||
webPreferences: {
|
},
|
||||||
contextIsolation: true,
|
});
|
||||||
nodeIntegration: false,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Open the DevTools.
|
// Open the DevTools.
|
||||||
if (DEV_MODE) {
|
if (DEV_MODE) {
|
||||||
installExtension(REACT_DEVELOPER_TOOLS)
|
|
||||||
.then((extensionName) => console.log(`Added Extension: ${extensionName}`))
|
|
||||||
.catch((err) => console.log('An error occurred: ', err));
|
|
||||||
|
|
||||||
mainWindow.webContents.openDevTools({
|
mainWindow.webContents.openDevTools({
|
||||||
mode: 'bottom',
|
mode: 'bottom',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the index.html of the app.
|
// load the index.html of the app.
|
||||||
const startUrl = process.env.ELECTRON_START_URL || url.format({
|
const startUrl = DEV_MODE
|
||||||
pathname: path.join(__dirname, '/../../build/index.html'),
|
? 'http://localhost:3000'
|
||||||
protocol: 'file:',
|
: `file://${path.join(__dirname, '/../../build/index.html')}`;
|
||||||
slashes: true,
|
|
||||||
});
|
|
||||||
mainWindow.loadURL(startUrl);
|
mainWindow.loadURL(startUrl);
|
||||||
|
|
||||||
// Emitted when the window is closed.
|
// Emitted when the window is closed.
|
||||||
|
Loading…
Reference in New Issue
Block a user