Skip to content

fix: add Node shim so npm creates bin symlink on install#42

Merged
xehl merged 1 commit intomainfrom
fix/npm-bin-shim
Mar 4, 2026
Merged

fix: add Node shim so npm creates bin symlink on install#42
xehl merged 1 commit intomainfrom
fix/npm-bin-shim

Conversation

@xehl
Copy link
Contributor

@xehl xehl commented Mar 4, 2026

Summary

  • npm install -g @trycourier/cli silently fails to create the courier bin symlink because npm links before postinstall runs, and the native binary doesn't exist in the tarball yet (only bin/.gitkeep)
  • Adds npm/bin/courier.js, a Node shim that execFileSyncs the native binary downloaded by postinstall. Same pattern used by biome and esbuild.
  • Changes package.json bin from ./bin/courier to ./bin/courier.js so npm has a real file to symlink at install time
  • Verified with cold-start uninstall/reinstall: symlink created, binary runs, API calls work

npm creates bin symlinks before running postinstall, so pointing
bin at ./bin/courier (which doesn't exist in the tarball) silently
skips symlink creation. The native binary only appears after
postinstall downloads it.

Add a courier.js shim that ships in the tarball and delegates to
the native binary via execFileSync. Same pattern as biome/esbuild.
@xehl xehl merged commit 1130bb4 into main Mar 4, 2026
7 checks passed
@xehl xehl deleted the fix/npm-bin-shim branch March 4, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant