diff --git a/docs/Auto Update.md b/docs/Auto Update.md index 04868c0703c..d0f92eec145 100644 --- a/docs/Auto Update.md +++ b/docs/Auto Update.md @@ -330,7 +330,7 @@ Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [do | --- | --- | --- | | autoDownload = true| boolean | Whether to automatically download an update when it is found. | | allowPrerelease| boolean | *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`). | -| allowDowngrade| boolean | Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel). Defaults to `true` if application version contains prerelease components (e.g. `0.12.1-alpha.1`, here `alpha` is a prerelease component), otherwise `false`. | +| allowDowngrade| boolean | Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel). | | requestHeaders| [RequestHeaders](electron-builder-http#RequestHeaders) \| null | The request headers. | | logger = (<any>global).__test_app ? null : console| [Logger](#Logger) \| null | The logger. You can pass [electron-log](https://github.com/megahertz/electron-log), [winston](https://github.com/winstonjs/winston) or another logger with the following interface: `{ info(), warn(), error() }`. Set it to `null` if you would like to disable a logging feature. | | signals = new UpdaterSignal(this)| [UpdaterSignal](#UpdaterSignal) | For type safety you can use signals, e.g. `autoUpdater.signals.updateDownloaded(() => {})` instead of `autoUpdater.on('update-available', () => {})` | diff --git a/packages/electron-updater/src/AppUpdater.ts b/packages/electron-updater/src/AppUpdater.ts index da280773d8c..9040423c189 100644 --- a/packages/electron-updater/src/AppUpdater.ts +++ b/packages/electron-updater/src/AppUpdater.ts @@ -38,7 +38,7 @@ export abstract class AppUpdater extends EventEmitter { /** * Whether to allow version downgrade (when a user from the beta channel wants to go back to the stable channel). - * Defaults to `true` if application version contains prerelease components (e.g. `0.12.1-alpha.1`, here `alpha` is a prerelease component), otherwise `false`. + * @default false */ allowDowngrade = false @@ -117,8 +117,7 @@ export abstract class AppUpdater extends EventEmitter { throw new Error(`App version is not valid semver version: "${currentVersionString}`) } - this.allowDowngrade = hasPrereleaseComponents(this.currentVersion) - this.allowPrerelease = this.allowDowngrade + this.allowPrerelease = hasPrereleaseComponents(this.currentVersion) if (options != null) { this.setFeedURL(options) diff --git a/test/src/nsisUpdaterTest.ts b/test/src/nsisUpdaterTest.ts index ccbd3f5d96f..d856c294fee 100644 --- a/test/src/nsisUpdaterTest.ts +++ b/test/src/nsisUpdaterTest.ts @@ -45,6 +45,7 @@ test("check updates - no versions at all", async () => { async function testUpdateFromBintray(app: any) { const updater = new NsisUpdater(null, app) + updater.allowDowngrade = true updater.updateConfigPath = await writeUpdateConfig({ provider: "bintray", owner: "actperepo",