From 4e4a91583f21fe901a5b1ceecea0b038ab3d788d Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Thu, 23 Jul 2026 10:49:58 +0530 Subject: [PATCH] fix(x): stage only the current platform's node-pty prebuilds Every build shipped all platforms' prebuilt binaries. Windows code signing walks every .node file in the app and signtool hard-fails on the Mach-O darwin pty.node ("file format cannot be signed"). Filtering to the host platform fixes signing and drops dead weight from all installers. The Linux CI-compiled prebuild and the node-gyp self-heal path both still stage correctly. Co-Authored-By: Claude Fable 5 --- apps/x/apps/main/bundle.mjs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/x/apps/main/bundle.mjs b/apps/x/apps/main/bundle.mjs index cca7fdc4..f4c0357d 100644 --- a/apps/x/apps/main/bundle.mjs +++ b/apps/x/apps/main/bundle.mjs @@ -59,10 +59,20 @@ const ptySrc = fs.realpathSync(path.join(here, 'node_modules', 'node-pty')); const ptyDest = path.join(here, '.package', 'node_modules', 'node-pty'); fs.rmSync(ptyDest, { recursive: true, force: true }); fs.mkdirSync(ptyDest, { recursive: true }); -for (const item of ['package.json', 'lib', 'prebuilds']) { +for (const item of ['package.json', 'lib']) { fs.cpSync(path.join(ptySrc, item), path.join(ptyDest, item), { recursive: true, dereference: true }); } +// Stage only the CURRENT platform's prebuilds. Each OS packages natively in CI, +// so other platforms' binaries are dead weight — and worse: Windows code signing +// walks every .node file in the app and signtool hard-fails on the Mach-O darwin +// pty.node ("file format cannot be signed"). +const prebuildsSrc = path.join(ptySrc, 'prebuilds'); const prebuildsDir = path.join(ptyDest, 'prebuilds'); +fs.mkdirSync(prebuildsDir, { recursive: true }); +for (const dir of fs.readdirSync(prebuildsSrc)) { + if (!dir.startsWith(`${process.platform}-`)) continue; + fs.cpSync(path.join(prebuildsSrc, dir), path.join(prebuildsDir, dir), { recursive: true, dereference: true }); +} for (const dir of fs.readdirSync(prebuildsDir)) { const helper = path.join(prebuildsDir, dir, 'spawn-helper'); if (fs.existsSync(helper)) fs.chmodSync(helper, 0o755);