@todesktop/runtime
Advanced tools
Comparing version 2.0.0 to 2.1.0-0
@@ -10,2 +10,3 @@ import type { AllPublishOptions, PublishConfiguration } from "builder-util-runtime"; | ||
readonly shouldNotify?: boolean; | ||
readonly buildId?: string; | ||
}; | ||
@@ -15,2 +16,3 @@ export default class AutoUpdater extends BaseAutoUpdater { | ||
private readonly _autoCheckInterval; | ||
private readonly _buildId?; | ||
private readonly _createdAt; | ||
@@ -26,3 +28,3 @@ private _hasUpdateReadyToInstall; | ||
constructor({ autoCheckInterval, // 10 min | ||
logger, shouldAutoCheckOnLaunch, }: AutoUpdaterConstructorOptions); | ||
logger, shouldAutoCheckOnLaunch, buildId, }: AutoUpdaterConstructorOptions); | ||
checkForUpdates({ source, disableUpdateReadyAction, }?: CheckForUpdatesInput): Promise<UpdateCheckResult>; | ||
@@ -29,0 +31,0 @@ restartAndInstall({ isSilent, }?: RestartAndInstallInput): void; |
@@ -26,3 +26,3 @@ "use strict"; | ||
constructor({ autoCheckInterval = 10 * 60 * 1000, // 10 min | ||
logger, shouldAutoCheckOnLaunch = true, }) { | ||
logger, shouldAutoCheckOnLaunch = true, buildId, }) { | ||
super(); | ||
@@ -37,2 +37,5 @@ this._createdAt = Date.now(); | ||
this._shouldAutoCheckOnLaunch = shouldAutoCheckOnLaunch; | ||
if (buildId) { | ||
this._buildId = buildId; | ||
} | ||
this._whenInitialized = new Promise((resolve) => { | ||
@@ -57,3 +60,4 @@ this._whenInitializedResolve = resolve; | ||
yield (0, alwaysResolve_1.default)(this._appFinishedLaunchingPromise, { logger }); | ||
if (inactiveReason === "") { | ||
if (inactiveReason === "" && !this._buildId) { | ||
// Check if the current build is released before updating _unless_ we're targeting a specific build | ||
const { isReleased } = yield (0, alwaysResolve_1.default)(getReleaseStatusFn(logger), { | ||
@@ -269,2 +273,7 @@ logger, | ||
} | ||
if (this._buildId) { | ||
this._log("debug", "Setting up UpdaterAgent with buildId", this._buildId); | ||
electronUpdater.autoUpdater.channel = `latest-build-${this._buildId}`; | ||
return; | ||
} | ||
this._log("debug", "Setting up UpdaterAgent"); | ||
@@ -271,0 +280,0 @@ this._updaterAgent = new updaterAgents_1.UpdaterAgent({ |
@@ -35,3 +35,3 @@ "use strict"; | ||
_init(_a = {}) { | ||
var { autoCheckInterval, autoUpdater = true, customLogger, shouldAutoCheckOnLaunch, updateReadyAction } = _a, initAutoUpdaterOptions = __rest(_a, ["autoCheckInterval", "autoUpdater", "customLogger", "shouldAutoCheckOnLaunch", "updateReadyAction"]); | ||
var { autoCheckInterval, autoUpdater = true, customLogger, shouldAutoCheckOnLaunch, updateReadyAction, buildId } = _a, initAutoUpdaterOptions = __rest(_a, ["autoCheckInterval", "autoUpdater", "customLogger", "shouldAutoCheckOnLaunch", "updateReadyAction", "buildId"]); | ||
const logger = new Logger_1.default(customLogger); | ||
@@ -47,2 +47,3 @@ const Updater = (0, SimulatedAutoUpdater_1.parseSimulateUpdatesFlag)() | ||
shouldAutoCheckOnLaunch, | ||
buildId, | ||
}); | ||
@@ -49,0 +50,0 @@ new Notifier_1.default({ autoUpdater: autoUpdaterInstance, updateReadyAction }); |
@@ -46,3 +46,4 @@ import { Notification, NotificationConstructorOptions } from "electron"; | ||
updateReadyAction?: UpdateReadyAction; | ||
buildId?: string; | ||
}; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const CLIENT_VERSION = "2.0.0"; | ||
export declare const CLIENT_VERSION = "2.1.0-0"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CLIENT_VERSION = void 0; | ||
exports.CLIENT_VERSION = "2.0.0"; | ||
exports.CLIENT_VERSION = "2.1.0-0"; |
@@ -7,3 +7,3 @@ { | ||
"name": "@todesktop/runtime", | ||
"version": "2.0.0", | ||
"version": "2.1.0-0", | ||
"license": "MIT", | ||
@@ -10,0 +10,0 @@ "author": "ToDesktop <hi@todesktop.com> (https://www.todesktop.com/)", |
@@ -320,2 +320,20 @@ # @todesktop/runtime | ||
##### `options.buildId` (Optional) | ||
Type: `string` | ||
Default: `undefined` | ||
Specifies a build ID to check for updates against a specific `buildId`. When set, the auto-updater will only update to the specific build ID. If you are already on that build ID then no update will be downloaded. | ||
Example: | ||
```javascript | ||
const todesktop = require("@todesktop/runtime"); | ||
todesktop.init({ | ||
buildId: "beta", // Will check for updates in channel "latest-build-beta" | ||
}); | ||
``` | ||
### `.autoUpdater.checkForUpdates(options)` | ||
@@ -661,2 +679,6 @@ | ||
### v2.1.0 | ||
- Add support for `buildId` option to target updates to specific builds. | ||
### v2.0.0 | ||
@@ -663,0 +685,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
107121
1815
692
1