From d49af589d08af8f76e2ce255f5e441e0773436b7 Mon Sep 17 00:00:00 2001 From: Lex Christopherson Date: Fri, 13 Mar 2026 14:33:37 -0600 Subject: [PATCH] fix: include darwin-arm64 native binary in npm tarball (Phase A hotfix) The native .node binary was excluded from npm pack due to native/.gitignore ignoring addon/. Add native/.npmignore (overrides .gitignore for npm) and include native/addon in the files whitelist. Also improve the error message in the native loader to list supported platforms and link to issues. Co-Authored-By: Claude Opus 4.6 (1M context) --- native/.npmignore | 1 + package.json | 1 + packages/native/src/native.ts | 11 ++++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 native/.npmignore diff --git a/native/.npmignore b/native/.npmignore new file mode 100644 index 000000000..2f7896d1d --- /dev/null +++ b/native/.npmignore @@ -0,0 +1 @@ +target/ diff --git a/package.json b/package.json index d5e6b42a2..6744c04c0 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "pkg", "src/resources", "scripts/postinstall.js", + "native/addon", "package.json", "README.md" ], diff --git a/packages/native/src/native.ts b/packages/native/src/native.ts index a78a4f849..91ade924c 100644 --- a/packages/native/src/native.ts +++ b/packages/native/src/native.ts @@ -33,10 +33,19 @@ function loadNative(): Record { } const details = errors.map((e) => ` - ${e}`).join("\n"); + const supportedPlatforms = [ + "darwin-arm64", + "darwin-x64", + "linux-x64", + "linux-arm64", + "win32-x64", + ]; throw new Error( `Failed to load gsd_engine native addon for ${platformTag}.\n\n` + `Tried:\n${details}\n\n` + - `Build with: npm run build:native -w @gsd/native`, + `Supported platforms: ${supportedPlatforms.join(", ")}\n` + + `If your platform is listed, try reinstalling: npm i -g gsd-pi\n` + + `Otherwise, please open an issue: https://github.com/gsd-build/gsd-2/issues`, ); }