crude sketch for auto updating

RebeccaBranch
David Tookey 5 years ago
parent 14db1cd007
commit 0106230d12

@ -10,6 +10,7 @@ let tsSource = ts.createProject('tsconfig.json')
function clean(cb) {
del(['build/*']);
del(['out/*']);
cb();
}
@ -45,6 +46,10 @@ function validateConfigSources(cb) {
cb();
}
let deploy = () => {
};
function conf() {
return src(['src/assets/**/*', '!src/assets/**/*.scss'], {base: 'src/assets'})
.pipe(dest('build/assets/'));
@ -112,7 +117,6 @@ let validationRules = {
"description": stringLengthRule
}
}
}
@ -124,3 +128,4 @@ exports.tests = series(validateConfigSources, conf, style, scss, root, pkg, type
exports.runFast = series(validateConfigSources, conf, style, scss, root, pkg)
exports.deploy = series(clean, validateConfigSources, conf, style, scss, root, pkg, typescript, dependencies, deploy);

40
package-lock.json generated

@ -871,9 +871,9 @@
}
},
"base64-js": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
"integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==",
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"dev": true
},
"bcrypt-pbkdf": {
@ -4879,9 +4879,9 @@
}
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"dev": true
},
"yargs": {
@ -5394,9 +5394,9 @@
}
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"dev": true
},
"yargs": {
@ -5864,14 +5864,14 @@
}
},
"plist": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.1.tgz",
"integrity": "sha512-GpgvHHocGRyQm74b6FWEZZVRroHKE1I0/BTjAmySaohK+cUn+hZpbqXkc3KWgW3gQYkqcQej35FohcT0FRlkRQ==",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/plist/-/plist-3.0.2.tgz",
"integrity": "sha512-MSrkwZBdQ6YapHy87/8hDU8MnIcyxBKjeF+McXnr5A9MtffPewTs7G3hlpodT5TacyfIyFTaJEhh3GGcmasTgQ==",
"dev": true,
"requires": {
"base64-js": "^1.2.3",
"base64-js": "^1.5.1",
"xmlbuilder": "^9.0.7",
"xmldom": "0.1.x"
"xmldom": "^0.5.0"
}
},
"plugin-error": {
@ -6461,9 +6461,9 @@
}
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",
"integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==",
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"dev": true
},
"yargs": {
@ -7690,9 +7690,9 @@
"dev": true
},
"xmldom": {
"version": "0.1.31",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.31.tgz",
"integrity": "sha512-yS2uJflVQs6n+CyjHoaBmVSqIDevTAWrzMmjG1Gc7h1qQ7uVozNhEPJAwZXWyGQ/Gafo3fCwrcaokezLPupVyQ==",
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.5.0.tgz",
"integrity": "sha512-Foaj5FXVzgn7xFzsKeNIde9g6aFBxTPi37iwsno8QvApmtg7KYrr+OPyRHcJF7dud2a5nGRBXK3n0dL62Gf7PA==",
"dev": true
},
"xtend": {

@ -16,10 +16,10 @@
"start-fast": "gulp runFast && electron ./build --debug",
"dev": "npm run build && electron ./build --debug",
"package": "npm-run-all package:*",
"package:mac": "electron-packager ./build --overwrite --platform=darwin --arch=x64 --out=out --icon=assets/images/app.icns --osx-sign.identity='Developer ID Application: GitHub' --extend-info=assets/mac/info.plist",
"package:win32": "electron-packager ./build --overwrite --platform=win32 --arch=ia32 --out=out --icon=assets/images/app.ico",
"package:win64": "electron-packager ./build --overwrite --platform=win32 --arch=x64 --out=out --icon=assets/images/app.ico",
"package:linux": "electron-packager ./build --overwrite --platform=linux --arch=x64 --out=out",
"package:mac": "electron-packager ./build --overwrite --platform=darwin --arch=x64 --out=out --icon=src/assets/images/icon.ico --osx-sign.identity='Developer ID Application: GitHub' --extend-info=assets/mac/info.plist",
"package:win32": "electron-packager ./build --overwrite --platform=win32 --arch=ia32 --out=out --icon=src/assets/images/icon.ico",
"package:win64": "electron-packager ./build --overwrite --platform=win32 --arch=x64 --out=out --icon=src/assets/images/icon.ico",
"package:linux": "electron-packager ./build --overwrite --platform=linux --arch=x64 --out=out --icon=src/assets/images/icon.ico",
"package:installer": "node ./script/installer.js",
"release": "node ./script/release.js",
"prepack": "check-for-leaks",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

@ -2,19 +2,54 @@ require('update-electron-app')({
logger: require('electron-log')
})
const updateCheckInterval = 1000 * 60
const path = require('path')
const {app, BrowserWindow} = require('electron')
const {app, BrowserWindow, autoUpdater} = require('electron')
const server = 'https://update.jdsconsulting.net'
const url = `${server}/update/${process.platform}/${app.getVersion()}`
autoUpdater.setFeedURL({url})
autoUpdater.checkForUpdates();
setInterval(() => {
console.log("Checking for update...");
autoUpdater.checkForUpdates();
}, updateCheckInterval)
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
console.log("Handling updates...")
const dialogOpts = {
type: 'info',
buttons: ['Restart', 'Later'],
title: 'Application Update',
message: process.platform === 'win32' ? releaseNotes : releaseName,
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
}
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) autoUpdater.quitAndInstall()
})
})
autoUpdater.on('error', message => {
console.error('There was a problem updating the application')
console.error(message)
})
const debug = /--debug/.test(process.argv[2])
if (process.mas) app.setName('JDSfaulkner Portal')
if (process.mas) app.setName('JDS Consulting Portal')
let mainWindow = null
function initialize () {
function initialize() {
makeSingleInstance()
function createWindow () {
function createWindow() {
const windowOptions = {
width: 1080,
minWidth: 769,
@ -69,7 +104,7 @@ function initialize () {
//
// Returns true if the current version of the app should quit instead of
// launching.
function makeSingleInstance () {
function makeSingleInstance() {
if (process.mas) return
app.requestSingleInstanceLock()

Loading…
Cancel
Save