fix: make CLI work without Bun when installed via npm#38
Open
djhenry wants to merge 1 commit into
Open
Conversation
The bin entry pointed to src/main.ts with a #!/usr/bin/env bun shebang, so npm-installed users got 'env: bun: No such file or directory' on every command. Fixes Michaelliv#37 on Michaelliv/psst. Changes: - bin now points to dist/main.js (compiled by tsc in prepublishOnly) - Shebang changed to #!/usr/bin/env node - Replaced Bun.write() with node:fs/promises writeFile (export.ts) - Replaced Bun.file().text() with node:fs/promises readFile (import.ts, scan.ts) - Replaced Bun.Glob with recursive readdirSync walk (scan.ts) - Replaced Bun.stdin.stream() with Node.js readline interface (input.ts) - Added @types/node devDependency for TypeScript compilation keychain.ts already had if (isBun) guards with Node child_process fallbacks and required no changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Fixes #37 — users on Fedora (and any system without Bun) got
env: 'bun': No such file or directoryimmediately afternpm install -g psst-cli.Root causes:
bininpackage.jsonpointed to./src/main.tswhich carries a#!/usr/bin/env bunshebangBun.write,Bun.file,Bun.Glob,Bun.stdin) with no Node.js fallbackChanges:
binnow points to./dist/main.js(already compiled bytscinprepublishOnly)#!/usr/bin/env nodeBun.write()→node:fs/promiseswriteFile(export.ts)Bun.file().text()→node:fs/promisesreadFile(import.ts,scan.ts)Bun.Glob→ recursivereaddirSyncwalk (scan.ts)Bun.stdin.stream()→ Node.jsreadlineinterface (input.ts)@types/nodedevDependency for TypeScript compilationkeychain.tsalready hadif (isBun)runtime guards withchild_processfallbacks and needed no changes. The package continues to work under Bun as before.Test plan
npm install -g psst-clion a system without Bun, thenpsst --versionsucceedspsst init --globalcreates vault successfully under Node.jspsst set,psst get,psst list,psst runwork under Node.jsbun run src/main.tsstill works)🤖 Generated with Claude Code