fix(core): use platform-aware binary naming in postinstall and publish#28766
Open
lexlian wants to merge 2 commits into
Open
fix(core): use platform-aware binary naming in postinstall and publish#28766lexlian wants to merge 2 commits into
lexlian wants to merge 2 commits into
Conversation
Closes anomalyco#28639 Closes anomalyco#28114 Closes anomalyco#27906 The postinstall script hardcoded bin/opencode.exe as the target binary on all platforms, causing: - .exe suffix leakage into process names on macOS/Linux (tmux titles) - Bun global symlink breakage after bun update -g -i - npm bin field pointing to .exe on all platforms Fix: postinstall.mjs now uses sourceBinary (platform-aware) for the target path. publish.ts generates a Node.js shim at bin/opencode that delegates to the correct platform binary, and the npm package bin field points to ./bin/opencode (no .exe).
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #28639
Closes #28114
Closes #27906
Type of change
What does this PR do?
Since v1.15.1, the npm package shipped
bin/opencode.exeon all platforms. The postinstall script hardcodedbin/opencode.exeas the target regardless of OS, and the published package'sbinfield pointed to./bin/opencode.exe. This caused:.exesuffix leaking into OS process names on macOS/Linux (tmux window titles showopencode.exe)bun update -g -ileaving global symlinks stale (symlink pointed to oldbin/opencode, new target isbin/opencode.exe)bin/opencode.exenot executable on Linux when postinstall is skippedChanges:
postinstall.mjs:targetBinarynow usessourceBinary(platform-aware) —bin/opencodeon macOS/Linux,bin/opencode.exeon Windowspublish.ts: replaces the shell error fallback with a Node.js shim atbin/opencodethat delegates to the correct platform binary, and the npm packagebinfield points to./bin/opencodeHow did you verify your code works?
targetBinaryresolves tobin/opencodeon darwin (inline test)bun typecheckpassed inpackages/opencodeScreenshots / recordings
N/A — no UI changes.
Checklist