Skip to content

Commit

Permalink
feat(electron-updater): electron-updater will update even I don't cal…
Browse files Browse the repository at this point in the history
…l quitAndInstall after app quit

Close #2493
  • Loading branch information
develar committed Jan 19, 2018
1 parent 3ecf08c commit 29f1c10
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/electron-builder-lib/src/platformPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,14 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
const envName = p1.substring("env.".length)
const envValue = process.env[envName]
if (envValue == null) {
throw new InvalidConfigurationError(`cannot expand pattern "${pattern}": env ${envName} is not defined`)
throw new InvalidConfigurationError(`cannot expand pattern "${pattern}": env ${envName} is not defined`, "ERR_ELECTRON_BUILDER_ENV_NOT_DEFINED")
}
return envValue
}

const value = extra[p1]
if (value == null) {
throw new InvalidConfigurationError(`cannot expand pattern "${pattern}": macro ${p1} is not defined`)
throw new InvalidConfigurationError(`cannot expand pattern "${pattern}": macro ${p1} is not defined`, "ERR_ELECTRON_BUILDER_MACRO_NOT_DEFINED")
}
else {
return value
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder-lib/src/targets/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function getLinuxToolsPath() {

export function getAppImage() {
//noinspection SpellCheckingInspection
return getBinFromGithub("appimage", "9.0.4", "pTFOnybYI2iGAyDUgXjzTkfuQ/E2ux8uLI1lXGB0RDoKhvFEq3y+q0sFzMOsbPTKZCcBRGhTujRlnsnTwgJmyw==")
return getBinFromGithub("appimage", "9.0.5", "AZbiBSeyow/pKCzeyIwVtogIUSWD4GxAxkqwL9GQcL1vq+EhcNPeMKOdlSI045SU4pknU4ceLwO5tzV7o0tNOw==")
}

export const fpmPath = new Lazy(() => {
Expand Down
15 changes: 11 additions & 4 deletions packages/electron-updater/src/AppUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,33 @@ export abstract class AppUpdater extends EventEmitter {
/**
* Whether to automatically download an update when it is found.
*/
autoDownload = true
autoDownload: boolean = true

/**
* Whether to automatically install a downloaded update on app quit (if `quitAndInstall` was not called before).
*
* Applicable only on Windows and Linux.
*/
autoInstallOnAppQuit: boolean = true

/**
* *GitHub provider only.* Whether to allow update to pre-release versions. Defaults to `true` if application version contains prerelease components (e.g. `0.12.1-alpha.1`, here `alpha` is a prerelease component), otherwise `false`.
*
* If `true`, downgrade will be allowed (`allowDowngrade` will be set to `true`).
*/
allowPrerelease = false
allowPrerelease: boolean = false

/**
* *GitHub provider only.* Get all release notes (from current version to latest), not just the latest.
* @default false
*/
fullChangelog = false
fullChangelog: boolean = false

/**
* Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel).
* @default false
*/
allowDowngrade = false
allowDowngrade: boolean = false

/**
* The current application version.
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-updater/src/BaseUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export abstract class BaseUpdater extends AppUpdater {
}

protected addQuitHandler() {
if (this.quitHandlerAdded) {
if (this.quitHandlerAdded || !this.autoInstallOnAppQuit) {
return
}

Expand Down
2 changes: 1 addition & 1 deletion test/out/__snapshots__/filesTest.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`expand not defined env 1`] = `"Env FOO_NOT_DEFINED is not defined"`;
exports[`expand not defined env 1`] = `"ERR_ELECTRON_BUILDER_ENV_NOT_DEFINED"`;

exports[`extraResources - two-package 1`] = `
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Object {
}
`;

exports[`file associations only perMachine 1`] = `"Please set perMachine to true — file associations works on Windows only if installed for all users"`;
exports[`file associations only perMachine 1`] = `"ERR_ELECTRON_BUILDER_INVALID_CONFIGURATION"`;

exports[`html license 1`] = `
Object {
Expand Down

0 comments on commit 29f1c10

Please sign in to comment.