From 41289c960b349d7452ad6ed371f74741b35210c4 Mon Sep 17 00:00:00 2001 From: David Kaya Date: Mon, 30 Mar 2026 10:24:07 +0200 Subject: [PATCH] fix: enable update checks in dev mode via forceDevUpdateConfig Add dev-app-update.yml so electron-updater can check GitHub releases even when running with bun run dev. Remove the isPackaged guard from checkForUpdates() so manual clicks always contact the update server. Automatic periodic checks remain disabled in dev mode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dev-app-update.yml | 4 ++++ src/main/services/autoUpdater.ts | 6 ++---- tests/main/autoUpdater.test.ts | 10 +++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 dev-app-update.yml 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 () => {