Skip to content

Commit e898705

Browse files
authored
[BRE-2024] Fix x86_64 macOS NAPI build producing ARM64 binaries (#1531)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/BRE-2024 ## πŸ“” Objective When [BRE-1302](https://bitwarden.atlassian.net/browse/BRE-1302) upgraded the macOS runner from `macos-13` (Intel) to `macos-15` (ARM64), the `x86_64` build job began running on ARM64 hardware. The build command `npm run build` uses the `--platform` flag, which auto-detects the host architecture rather than respecting the target triple. This caused the `x86_64` job to build `ARM64` binaries instead. Changes: - Add `build-x64` script to `package.json` that explicitly targets `x86_64-apple-darwin`, mirroring the existing `build-arm64` pattern - Update `build-napi.yml` to use `npm run build-x64` for the `x86_64` job This ensures the `x86_64 job` produces `sdk-napi.darwin-x64.node` (Intel) instead of incorrectly producing `sdk-napi.darwin-arm64.node` (ARM). ## 🚨 Breaking Changes <!-- If this PR introduces a breaking change for any downstream consumer, call it out clearly. For breaking changes: 1. Describe what changed in the public interface 2. Explain why the change was necessary 3. Provide migration steps for consumers 4. Link to any paired consumer PRs if needed Otherwise, you can remove this section. --> [BRE-1302]: https://bitwarden.atlassian.net/browse/BRE-1302?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 2f2c866 commit e898705

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

β€Ž.github/workflows/build-napi.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- os: macos-15
3434
target: x86_64-apple-darwin
3535
build: |
36-
npm run build
36+
npm run build-x64
3737
strip -x *.node
3838
3939
- os: macos-15

β€Žcrates/bitwarden-napi/package.jsonβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"artifacts": "napi artifacts",
2424
"build": "napi build --platform --release --js binding.js --dts binding.d.ts && tsc",
2525
"build-arm64": "napi build --target aarch64-apple-darwin --platform --release --js binding.js --dts binding.d.ts && tsc",
26+
"build-x64": "napi build --target x86_64-apple-darwin --platform --release --js binding.js --dts binding.d.ts && tsc",
2627
"build:debug": "napi build --platform",
2728
"prepublishOnly": "napi prepublish --skip-gh-release",
2829
"tsc": "tsc",

0 commit comments

Comments
Β (0)