From 8d5b712de3cbd84118327808c403756e8894014a Mon Sep 17 00:00:00 2001 From: Exotic <118054752+extoci@users.noreply.github.com> Date: Wed, 2 Sep 2026 23:44:30 +0300 Subject: [PATCH] fix(desktop): exclude opposite macOS pty prebuilds (#9240) --- scripts/build-desktop-artifact.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/build-desktop-artifact.ts b/scripts/build-desktop-artifact.ts index 9e6f1457c4217a6a3adade3c6b304ab2162897b6..17c038979d0eae69bc9b8aa23e85bd3f18db5c87 100644 --- a/scripts/build-desktop-artifact.ts +++ b/scripts/build-desktop-artifact.ts @@ -941,6 +941,19 @@ export const MAC_FILE_EXCLUSIONS = [ "!**/node_modules/node-pty/prebuilds/win32-*/**/*", "!**/node_modules/node-pty/third_party/conpty/**/*", ] as const; + +// node-pty publishes both Darwin prebuilds in one package. Single-architecture +// apps only need the native target; universal apps need both. An omitted arch +// preserves the existing common exclusions for callers that only inspect the +// generic platform config. +export function resolveMacFileExclusions(arch?: typeof BuildArch.Type) { + if (arch === undefined || arch === "universal") { + return [...MAC_FILE_EXCLUSIONS]; + } + + const unusedArch = arch === "arm64" ? "x64" : "arm64"; + return [...MAC_FILE_EXCLUSIONS, `!**/node_modules/node-pty/prebuilds/darwin-${unusedArch}/**/*`]; +} // Windows ships the server tree (bundle + node_modules) as a separate // resources/server.asar sidecar instead of loose files: the NSIS installer // then extracts a handful of large archives instead of thousands of small @@ -2428,13 +2441,17 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* ( // sidecar staging skips the archive in that case, and listing a resource // whose source file was never written fails the electron-builder step. wslRuntimeBundled = false, + arch?: typeof BuildArch.Type, ) { const buildConfig: Record = { appId: DESKTOP_APP_ID, productName: resolveDesktopProductName(version), artifactName: "T3-Code-${version}-${arch}.${ext}", electronLanguages: [...DESKTOP_ELECTRON_LANGUAGES], - files: [...DESKTOP_FILE_EXCLUSIONS, ...(platform === "mac" ? MAC_FILE_EXCLUSIONS : [])], + files: [ + ...DESKTOP_FILE_EXCLUSIONS, + ...(platform === "mac" ? resolveMacFileExclusions(arch) : []), + ], directories: { buildResources: "apps/desktop/resources", }, @@ -3502,6 +3519,7 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( } : undefined, bundlesWslRuntime({ arch: options.arch, prebuildPath: options.wslPrebuild }), + options.arch, ), dependencies: stageDependencies, devDependencies: { -- 2.54.0