Skip to content

Commit a0bfd9e

Browse files
author
Milo Todt
committed
Disables updates in development mode
1 parent 5a9de1a commit a0bfd9e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/main-app.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ const electron = require('electron')
22
const app = electron.app
33
const Menu = electron.Menu
44
const ipc = electron.ipcMain
5-
const GhReleases = require('electron-gh-releases')
5+
const GhReleases = require('electron-gh-releases')
6+
const isDev = require('electron-is-dev') //isDev is True if running in development mode. Overide by setting ELECTRON_IS_DEV environment variable to 1
67
// electron.crashReporter.start()
78
var ipcServer = null
89

@@ -35,6 +36,10 @@ const updater = new GhReleases(ghReleasesOpts)
3536
// Check for updates
3637
// `status` returns true if there is a new update available
3738
function checkUpdate () {
39+
if (isDev){ //Prevents app from attempting to update when in dev mode.
40+
console.log("Updates are disabled in Development mode, see main-app.js")
41+
return true
42+
}
3843
if (process.platform === 'linux' || isUpdateReady) {
3944
return true
4045
}
@@ -94,12 +99,12 @@ app.on('ready', function () {
9499

95100
// Check update every day
96101
setInterval(function () {
97-
checkUpdate()
102+
if(!isDev) checkUpdate()
98103
}, 1000 * 60 * 60 * 24)
99104

100105
// Check update after 10 secs to prevent file locking of Windows
101106
setTimeout(() => {
102-
checkUpdate()
107+
if(!isDev) checkUpdate()
103108

104109
ipc.on('update-check', function (event, msg) {
105110
if (isUpdateReady) {

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"codemirror-mode-elixir": "^1.1.1",
6060
"electron-config": "^1.0.0",
6161
"electron-gh-releases": "^2.0.4",
62+
"electron-is-dev": "^1.0.1",
6263
"escape-string-regexp": "^1.0.5",
6364
"file-uri-to-path": "^1.0.0",
6465
"file-url": "^2.0.2",

0 commit comments

Comments
 (0)