Skip to content

Commit d0a9b49

Browse files
authored
fix(desktop): make electronDist override opt-in to unbreak nightly codesign (#863)
PR #698 unconditionally passed --config.electronDist pointing at the electron package's dist directory inside the pnpm store. On the macOS arm64 nightly runner, electron-builder copies Electron.app from that path into the release output, but the framework version symlinks (Electron Framework.framework/Versions/Current → A, etc.) do not survive the copy out of the pnpm content-addressable store. The resulting framework bundle has both top-level files and a Versions/ directory, which causes codesign to fail with: Electron Framework: bundle format is ambiguous (could be app or framework) The 04-07 nightly run (24058395128) hit this and codesign hung for ~6 minutes before exiting. The 04-06 run (pre-#698) succeeded. Restore the previous behavior: only forward --config.electronDist to electron-builder when NEXU_DESKTOP_ELECTRON_DIST_PATH is explicitly set (the e2e coverage tooling use case). Otherwise let electron-builder resolve electron via its default pnpm-aware path, which preserves framework symlinks correctly.
1 parent 28eb4bc commit d0a9b49

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

apps/desktop/scripts/dist-mac.mjs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,19 @@ async function ensureExistingRuntimeInstall() {
116116
]);
117117
}
118118

119+
// Only honor an explicitly provided electron dist override (used by e2e
120+
// coverage tooling). When unset, return null so electron-builder falls back
121+
// to its default electron resolution. Pointing electron-builder directly at
122+
// the pnpm-stored Electron.app caused codesign to fail with "bundle format is
123+
// ambiguous" because the framework symlink layout did not survive the copy
124+
// from the pnpm content-addressable store (regression from #698).
119125
async function resolveElectronDistPath() {
120-
if (process.env.NEXU_DESKTOP_ELECTRON_DIST_PATH) {
121-
return process.env.NEXU_DESKTOP_ELECTRON_DIST_PATH;
126+
const override = process.env.NEXU_DESKTOP_ELECTRON_DIST_PATH;
127+
if (!override) {
128+
return null;
122129
}
123-
124-
const electronPackageJsonPath = require.resolve("electron/package.json", {
125-
paths: [electronRoot, repoRoot],
126-
});
127-
const electronDistPath = resolve(dirname(electronPackageJsonPath), "dist");
128-
await ensureExistingPath(electronDistPath, "electron dist");
129-
return electronDistPath;
130+
await ensureExistingPath(override, "electron dist override");
131+
return override;
130132
}
131133

132134
async function timedStep(stepName, fn, timings) {
@@ -805,7 +807,9 @@ async function main() {
805807
"--publish",
806808
"never",
807809
`--config.electronVersion=${electronVersion}`,
808-
`--config.electronDist=${electronDistPath}`,
810+
...(electronDistPath
811+
? [`--config.electronDist=${electronDistPath}`]
812+
: []),
809813
`--config.buildVersion=${buildVersion}`,
810814
`--config.directories.output=${releaseRoot}`,
811815
...(isFastCiMode

0 commit comments

Comments
 (0)