fix: run the local Composer bin with bun run --bun so the converge child runs under Bun too - #8
Merged
Conversation
…ild runs under Bun too `bun <absolute path>` runs only the Composer CLI under Bun. The converge child Composer spawns is a `#!/usr/bin/env node` launcher that picks Bun only when Bun announced itself through npm_config_user_agent/npm_execpath, which Bun does for `bun run <bin>` but not for an absolute file path. The child then ran under Node and could not resolve the generated `./service.js` import to `service.ts`. `bun run --bun prisma-composer` puts a `node` → bun shim first on PATH, so the CLI and every process it spawns run under Bun, independent of the launcher's detection.
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.
Why
With v1.4.0 the action runs the repo's local Composer bin as
bun /abs/path/node_modules/.bin/prisma-composer. That runs the Composer CLI under Bun, but the converge child Composer spawns still ran under Node — and failed on the generatedimport … from "./service.js"(Node cannot map it toservice.ts; Bun can).The child is a
#!/usr/bin/env nodelauncher (node_modules/.bin/alchemy) that switches to Bun only when Bun announced itself throughnpm_config_user_agent/npm_execpath. Bun sets those forbun run <bin>,bunx, and a relativenode_modules/.bin/<bin>path, but not for an absolute file path — the shape the action used.Observed on a stock Next.js repo: kristof-siket/next-stock run 32251429621 —
composer=local bin (bun)followed by(node:2461) … Cannot find module '…/service.js' imported from …/module.ts.What
The local-bin branch of
selectComposerCommandnow returnsbun run --bun prisma-composer(the action already runs withcwd= working directory).--bunputs anode→ bun shim first onPATH, so the CLI and every process it spawns run under Bun, independent of the launcher's detection. The bunx fallback branch already had--bunand is unchanged.bun /abs/…/prisma-composer(v1.4.0)bun run prisma-composer(no--bun)bun run --bun prisma-composer(this PR)bunx --bun -p @prisma/composer-cli@… prisma-composer(fallback)Verified locally with Composer 0.9.0 by spawning the launcher the way Composer does under each shape; argument passthrough (
deploy module.ts --stage …) checked. The real end-to-end proof is thenext-stockrerun afterv1moves.Release
Tag
v1.4.1and movev1after merge. No change needed to generated workflows: they already addoven-sh/setup-bun@v2before this action.