diff --git a/dev-app-update.yml b/dev-app-update.yml new file mode 100644 index 0000000..d8c11fc --- /dev/null +++ b/dev-app-update.yml @@ -0,0 +1,4 @@ +provider: github +owner: davidkaya +repo: aryx +releaseType: release diff --git a/src/main/services/autoUpdater.ts b/src/main/services/autoUpdater.ts index 75dae31..eefda72 100644 --- a/src/main/services/autoUpdater.ts +++ b/src/main/services/autoUpdater.ts @@ -23,6 +23,7 @@ type AutoUpdateListener = (...args: any[]) => void; interface AutoUpdaterLike { autoDownload: boolean; autoInstallOnAppQuit: boolean; + forceDevUpdateConfig: boolean; on(event: string, listener: AutoUpdateListener): this; removeListener(event: string, listener: AutoUpdateListener): this; checkForUpdates(): Promise; @@ -180,6 +181,7 @@ export class AutoUpdateService { this.scheduler = options.scheduler ?? defaultScheduler; this.updater.autoDownload = true; this.updater.autoInstallOnAppQuit = false; + this.updater.forceDevUpdateConfig = !options.isPackaged; this.updater.on('checking-for-update', this.checkingListener); this.updater.on('update-available', this.availableListener); @@ -215,10 +217,6 @@ export class AutoUpdateService { } async checkForUpdates(): Promise { - if (!this.options.isPackaged) { - return this.getStatus(); - } - if (this.pendingCheck) { return this.pendingCheck; } diff --git a/tests/main/autoUpdater.test.ts b/tests/main/autoUpdater.test.ts index 2824956..4912a02 100644 --- a/tests/main/autoUpdater.test.ts +++ b/tests/main/autoUpdater.test.ts @@ -10,6 +10,8 @@ class FakeUpdater extends EventEmitter { autoInstallOnAppQuit = true; + forceDevUpdateConfig = false; + checkForUpdatesCalls = 0; quitAndInstallCalls = 0; @@ -62,7 +64,7 @@ class FakeScheduler implements AutoUpdateScheduler { } describe('AutoUpdateService', () => { - test('does not schedule checks for unpackaged apps', async () => { + test('does not schedule checks for unpackaged apps but manual checks still work', async () => { const updater = new FakeUpdater(); const scheduler = new FakeScheduler(); const service = new AutoUpdateService({ isPackaged: false, scheduler, updater }); @@ -71,8 +73,10 @@ describe('AutoUpdateService', () => { expect(scheduler.timeouts).toHaveLength(0); expect(scheduler.intervals).toHaveLength(0); - expect(await service.checkForUpdates()).toEqual({ state: 'idle' }); - expect(updater.checkForUpdatesCalls).toBe(0); + expect(updater.forceDevUpdateConfig).toBe(true); + + await service.checkForUpdates(); + expect(updater.checkForUpdatesCalls).toBe(1); }); test('configures auto download and schedules startup and periodic checks', async () => {