diff --git a/config/electron-builder.config.cjs b/config/electron-builder.config.cjs index 4fa904ab6d4..577cbd97a93 100644 --- a/config/electron-builder.config.cjs +++ b/config/electron-builder.config.cjs @@ -129,6 +129,9 @@ module.exports = { '!out/**/*.test.js', // Why: Vite's manifest is only used to project the paired web client. '!out/renderer/.vite{,/**/*}', + // Why: out/electron-dev caches `pnpm dev`'s per-branch Electron.app copies (~270MB each). + // CI never creates it, but packaging on a machine that has run dev would pack them all. + '!out/electron-dev{,/**/*}', '!electron.vite.config.{js,ts,mjs,cjs}', '!{.eslintcache,eslint.config.mjs,.prettierignore,.prettierrc.yaml,CHANGELOG.md,README.md}', '!{.env,.env.*,.npmrc,pnpm-lock.yaml}', diff --git a/config/scripts/electron-builder-config.test.mjs b/config/scripts/electron-builder-config.test.mjs index 33578580dae..75c3898858e 100644 --- a/config/scripts/electron-builder-config.test.mjs +++ b/config/scripts/electron-builder-config.test.mjs @@ -75,6 +75,25 @@ describe('electron-builder config', () => { expect(packs('out/main/examples/index.js')).toBe(true) }) + // Why: out/electron-dev holds `pnpm dev`'s cached Electron.app copies (~270MB per branch). + // CI never creates it, so only a local package would have hit this -- silently, as bulk. + it('keeps cached dev Electron bundles out of app.asar', () => { + const matcher = new FileMatcher('/app', '/dest', (value) => value, electronBuilderConfig.files) + matcher.prependPattern('**/*') + const isPacked = matcher.createFilter() + const packs = (repoPath) => isPacked(join('/app', repoPath), { isDirectory: () => false }) + + for (const devBundlePath of [ + 'out/electron-dev/1a2b3c4d5e6f/Orca: dev.app/Contents/MacOS/Electron', + 'out/electron-dev/1a2b3c4d5e6f/orca-dev-electron-app.json' + ]) { + expect(packs(devBundlePath)).toBe(false) + } + // The real build outputs sit beside it under out/ and must still ship. + expect(packs('out/main/index.js')).toBe(true) + expect(packs('out/renderer/index.html')).toBe(true) + }) + it('keeps runtime resources available through extraResources', () => { const bundledPluginResources = expect.objectContaining({ from: 'resources/plugins/launch',