diff --git a/apps/desktop/src-tauri/tauri.conf.json b/apps/desktop/src-tauri/tauri.conf.json index b93e1e59..3caf0961 100644 --- a/apps/desktop/src-tauri/tauri.conf.json +++ b/apps/desktop/src-tauri/tauri.conf.json @@ -26,7 +26,7 @@ ], "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDdCQUZGMEVCMEZBOTk5RTcKUldUbm1ha1A2L0N2ZTlOZjN5T3pGOHBHRUlibytMY2tPeWJkQ01heDJzdTJqK3B3a2lBdDZ1T1oK", "windows": { - "installMode": "quiet" + "installMode": "passive" } } }, @@ -50,7 +50,14 @@ "bundle": { "active": true, "createUpdaterArtifacts": true, - "targets": "all", + "targets": [ + "app", + "dmg", + "deb", + "rpm", + "appimage", + "nsis" + ], "icon": [ "icons/32x32.png", "icons/128x128.png", diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index 3741edb4..b0d64656 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -104,6 +104,12 @@ function AppContent() { // into the new version — so a restart picks up updates with no clicks. // Otherwise just surface the dismissible banner for a manual install. useEffect(() => { + // Never auto-update under `pnpm dev`. A dev build would otherwise detect a + // newer published release, install it over this build, and relaunch — so + // your local changes would vanish before you could see them. Production + // builds (import.meta.env.DEV === false) are unaffected. + if (import.meta.env.DEV) return; + const checkForUpdates = async () => { try { const { checkForUpdate } = await import('@/lib/updates'); diff --git a/tests/ts/components/App.test.tsx b/tests/ts/components/App.test.tsx index d653ce5c..0fd35105 100644 --- a/tests/ts/components/App.test.tsx +++ b/tests/ts/components/App.test.tsx @@ -288,6 +288,10 @@ describe('App – dynamic gateway URL display', () => { describe('App – update banner', () => { beforeEach(() => { + // The startup auto-update check is gated behind `!import.meta.env.DEV` + // (it must never run under `pnpm dev`). Vitest runs in dev mode, so stub + // DEV=false here to exercise the production update flow. + vi.stubEnv('DEV', false); vi.useFakeTimers(); gatewayEventCallbacks = []; setupInvoke({ get_version: '0.1.2' }); @@ -296,6 +300,7 @@ describe('App – update banner', () => { afterEach(() => { vi.useRealTimers(); + vi.unstubAllEnvs(); }); it('should show update banner when update is available', async () => {