From b622df997efe237754d7fab90e071ab1ebd093bd Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Mon, 21 Nov 2016 19:05:19 +0100 Subject: [PATCH] Fix env detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was not working.. Use Sindre's module 🦄 --- package.json | 1 + src/index.js | 4 ++-- src/util.js | 6 ------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 08a2c2c2..d2cd1926 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/index.js b/src/index.js index 8ead4a63..e6dfe75f 100644 --- a/src/index.js +++ b/src/index.js @@ -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. diff --git a/src/util.js b/src/util.js index 37691e59..f8de2853 100644 --- a/src/util.js +++ b/src/util.js @@ -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, };