From a0bfd9e497a3b742b47977033f4f0c026fbd8e77 Mon Sep 17 00:00:00 2001 From: Milo Todt Date: Sat, 12 Jan 2019 17:58:19 -0800 Subject: [PATCH 1/5] Disables updates in development mode --- lib/main-app.js | 11 ++++++++--- package.json | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/main-app.js b/lib/main-app.js index f25d07d23..7a31d2820 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -2,7 +2,8 @@ const electron = require('electron') const app = electron.app const Menu = electron.Menu const ipc = electron.ipcMain -const GhReleases = require('electron-gh-releases') +const GhReleases = require('electron-gh-releases') +const isDev = require('electron-is-dev') //isDev is True if running in development mode. Overide by setting ELECTRON_IS_DEV environment variable to 1 // electron.crashReporter.start() var ipcServer = null @@ -35,6 +36,10 @@ const updater = new GhReleases(ghReleasesOpts) // Check for updates // `status` returns true if there is a new update available function checkUpdate () { + if (isDev){ //Prevents app from attempting to update when in dev mode. + console.log("Updates are disabled in Development mode, see main-app.js") + return true + } if (process.platform === 'linux' || isUpdateReady) { return true } @@ -94,12 +99,12 @@ app.on('ready', function () { // Check update every day setInterval(function () { - checkUpdate() + if(!isDev) checkUpdate() }, 1000 * 60 * 60 * 24) // Check update after 10 secs to prevent file locking of Windows setTimeout(() => { - checkUpdate() + if(!isDev) checkUpdate() ipc.on('update-check', function (event, msg) { if (isUpdateReady) { diff --git a/package.json b/package.json index 95b4ecd79..568d38525 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "codemirror-mode-elixir": "^1.1.1", "electron-config": "^1.0.0", "electron-gh-releases": "^2.0.4", + "electron-is-dev": "^1.0.1", "escape-string-regexp": "^1.0.5", "file-uri-to-path": "^1.0.0", "file-url": "^2.0.2", From fa77cda0b473bf3a3e5389aa64c9e84a92c2739e Mon Sep 17 00:00:00 2001 From: Milo Todt Date: Sat, 12 Jan 2019 17:59:04 -0800 Subject: [PATCH 2/5] whitespace --- lib/main-app.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/main-app.js b/lib/main-app.js index 7a31d2820..c56459406 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -2,8 +2,8 @@ const electron = require('electron') const app = electron.app const Menu = electron.Menu const ipc = electron.ipcMain -const GhReleases = require('electron-gh-releases') -const isDev = require('electron-is-dev') //isDev is True if running in development mode. Overide by setting ELECTRON_IS_DEV environment variable to 1 +const GhReleases = require('electron-gh-releases') +const isDev = require('electron-is-dev') // isDev is True if running in development mode. Overide by setting ELECTRON_IS_DEV environment variable to 1 // electron.crashReporter.start() var ipcServer = null @@ -36,8 +36,8 @@ const updater = new GhReleases(ghReleasesOpts) // Check for updates // `status` returns true if there is a new update available function checkUpdate () { - if (isDev){ //Prevents app from attempting to update when in dev mode. - console.log("Updates are disabled in Development mode, see main-app.js") + if (isDev) { // Prevents app from attempting to update when in dev mode. + console.log('Updates are disabled in Development mode, see main-app.js') return true } if (process.platform === 'linux' || isUpdateReady) { @@ -99,12 +99,12 @@ app.on('ready', function () { // Check update every day setInterval(function () { - if(!isDev) checkUpdate() + if (!isDev) checkUpdate() }, 1000 * 60 * 60 * 24) // Check update after 10 secs to prevent file locking of Windows setTimeout(() => { - if(!isDev) checkUpdate() + if (!isDev) checkUpdate() ipc.on('update-check', function (event, msg) { if (isUpdateReady) { From 038154c4415cccca429c2d8c353822e07805e610 Mon Sep 17 00:00:00 2001 From: Milo Todt Date: Sun, 13 Jan 2019 17:21:30 -0800 Subject: [PATCH 3/5] Removed uneeded "electron-is-dev" package --- lib/main-app.js | 2 +- package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/main-app.js b/lib/main-app.js index c56459406..57d6b26c6 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -3,7 +3,7 @@ const app = electron.app const Menu = electron.Menu const ipc = electron.ipcMain const GhReleases = require('electron-gh-releases') -const isDev = require('electron-is-dev') // isDev is True if running in development mode. Overide by setting ELECTRON_IS_DEV environment variable to 1 +const isDev = 'ELECTRON_IS_DEV' in process.env // electron.crashReporter.start() var ipcServer = null diff --git a/package.json b/package.json index 568d38525..95b4ecd79 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "codemirror-mode-elixir": "^1.1.1", "electron-config": "^1.0.0", "electron-gh-releases": "^2.0.4", - "electron-is-dev": "^1.0.1", "escape-string-regexp": "^1.0.5", "file-uri-to-path": "^1.0.0", "file-url": "^2.0.2", From c3a980836ad74ced7a0738b65bcc3ded674bdc33 Mon Sep 17 00:00:00 2001 From: Milo Todt Date: Sun, 20 Jan 2019 21:04:56 -0800 Subject: [PATCH 4/5] change to isDev --- lib/main-app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main-app.js b/lib/main-app.js index 57d6b26c6..7225dd9be 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -3,7 +3,7 @@ const app = electron.app const Menu = electron.Menu const ipc = electron.ipcMain const GhReleases = require('electron-gh-releases') -const isDev = 'ELECTRON_IS_DEV' in process.env +const isDev = 'ELECTRON_IS_DEV' in process.env && process.env.NODE_ENV !== 'production' // electron.crashReporter.start() var ipcServer = null From 667ece7d3f3f52ae8e468b727da68a7531f38fe9 Mon Sep 17 00:00:00 2001 From: Milo Todt Date: Tue, 22 Jan 2019 19:59:27 -0800 Subject: [PATCH 5/5] Update main-app.js --- lib/main-app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main-app.js b/lib/main-app.js index 7225dd9be..88e442944 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -3,7 +3,7 @@ const app = electron.app const Menu = electron.Menu const ipc = electron.ipcMain const GhReleases = require('electron-gh-releases') -const isDev = 'ELECTRON_IS_DEV' in process.env && process.env.NODE_ENV !== 'production' +const isDev = process.env.NODE_ENV !== 'production' // electron.crashReporter.start() var ipcServer = null