From dcdb763c9607c40670db721531b0767d5f34703b Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Sat, 1 Oct 2022 20:50:05 +0200 Subject: [PATCH] changed `isDevelopment` to an electron version --- src/Util.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Util.js b/src/Util.js index 1a108d5..6063c17 100644 --- a/src/Util.js +++ b/src/Util.js @@ -1,6 +1,13 @@ +const electron = require("electron"); + const isDevelopment = () => { - const mode = process.env.NODE_ENV || "development"; - return mode === "development"; + if (typeof electron === "string") + return true; + + const isEnvSet = "ELECTRON_IS_DEV" in process.env; + const getFromEnv = parseInt(process.env.ELECTRON_IS_DEV, 10) === 1; + + return isEnvSet ? getFromEnv : !electron.app.isPackaged; }; module.exports = {