Fix env detection

It was not working..
Use Sindre's module 🦄
pull/24/head
Mikael Finstad 2016-11-21 19:05:19 +01:00
rodzic fd03dcc139
commit b622df997e
3 zmienionych plików z 3 dodań i 8 usunięć

Wyświetl plik

@ -46,6 +46,7 @@
"classnames": "^2.2.5",
"electron": "^1.4.5",
"electron-default-menu": "^1.0.0",
"electron-is-dev": "^0.1.2",
"execa": "^0.5.0",
"file-type": "^3.9.0",
"jquery": "^3.1.1",

Wyświetl plik

@ -1,6 +1,6 @@
const electron = require('electron'); // eslint-disable-line
const isDev = require('electron-is-dev');
const util = require('./util');
const menu = require('./menu');
const app = electron.app;
@ -8,7 +8,7 @@ const BrowserWindow = electron.BrowserWindow;
app.setName('LosslessCut');
if (util.isPackaged()) process.env.NODE_ENV = 'production';
if (!isDev) process.env.NODE_ENV = 'production';
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.

Wyświetl plik

@ -14,12 +14,6 @@ function formatDuration(_seconds) {
return `${hoursPadded}.${minutesPadded}.${secondsPadded}.${msPadded}`;
}
function isPackaged() {
// http://stackoverflow.com/questions/39362292/how-do-i-set-node-env-production-on-electron-app-when-packaged-with-electron-pac
return process.execPath.search('electron-prebuilt') === -1;
}
module.exports = {
formatDuration,
isPackaged,
};