feat: run Composer under Bun for all repos - #7
Merged
Conversation
The deploy phase now runs `bun <localBin>` (local install) or `bunx --bun -p @prisma/composer-cli@<v> prisma-composer` (fallback) instead of the Node/npx equivalents. Bun is Composer's primary tested runtime and is tsconfig-aware, so `./service.ts`, `./service.js`, and extensionless imports all resolve without extra config. Node is a floor-smoke; it requires exact ESM paths and is where the TypeScript relative-import problem lives. If `bun` is not on PATH the action fails early with a message naming the fix. The generated Prisma deploy workflow (pdp-control-plane#TBD) adds `oven-sh/setup-bun@v2` to every workflow, making this transparent to users whose workflow is generated through the Console. Adds `composer.mjs` with the command-selection helper and `tests/composer.test.mjs` covering both paths. Note: the converge child Composer spawns for the actual deploy still runs under the child's own shebang in 0.9.0 (fixed in prisma/composer#247). End-to-end verification awaits that build.
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
Composer's own e2e tests and docs deploys run
bun node_modules/.bin/prisma-composer deploy …. Bun is Composer's primary tested runtime; Node is a floor-smoke. The action was previously running Composer under Node (the bin's shebang is#!/usr/bin/env node), which is Composer's least-tested path and is where the TypeScript relative-import problem lives (Node's ESM loader needs exact file paths; Bun resolves TypeScript-style natively and is tsconfig-aware). The Compute runtime itself is Bun. Running the deploy step under Bun:./service.ts/./service.js/ extensionless imports all work in CI without any Composer hookThe user's app is still installed and built with its own toolchain — nothing about the app changes.
What changed
main.mjs: the deploy phase now runsbun <localBin>(local install path) orbunx --bun -p @prisma/composer-cli@<v> prisma-composer(fallback). Ifbunis not on PATH the action fails early with a message naming the fix (oven-sh/setup-bun@v2). The generated Prisma deploy workflow — produced bypdp-control-planeand opened as a setup PR in the user's repo — adds that step automatically for every project.composer.mjs: pure command-selection helper extracted for testability.tests/composer.test.mjs: four tests covering both paths and the log labels.action.yml: updatedcomposer-versiondescription:npx→bunx.README.md: quick-start example now includesoven-sh/setup-bun@v2; added a Requirements section; updated How it works and composer-version table entry.bunx command
--bunforces the spawned bin to run under Bun instead of Node.-p(short for--package) installs the named package if not cached; bunx supports this flag perbunx --help. The local-bin path usesbun <absPath>directly.Relation to PR #6
PR #6 updates the
composer-versiondefault and fallback package reference (stale0.7.0default /npxvsbunx). The current PR supersedes thenpx → bunxpart of that intent; the stale-default concern in #6 can be addressed independently. Check its state before merging — if #6 merges first, no conflict; if this merges first, #6's fallback-package part needs rebasing.Local verification
With
@prisma/composer-cli@0.9.0installed viabun installin a scratch dir containingmodule.tsthat imports./service.js(where onlyservice.tsexists):bun <localBin> deploy module.ts --stage x→ fails atCONFIG.FILE_MISSING(Composer's config lookup runs before module evaluation), confirming the process starts and module resolution is not the stopper.node <localBin> deploy module.ts --stage x→ sameCONFIG.FILE_MISSINGresult with bun-installed deps, because bun's resolver is tsconfig-aware at install time.The specific TypeScript relative-import difference (
./service.jsfails on Node, resolves on Bun) is masked in this test by Composer's config check running first. The full end-to-end proof requires a properly configured project. Additionally: the converge child Composer spawns for the actual deploy still runs under the child's own shebang in 0.9.0 (being fixed in prisma/composer#247). Full end-to-end verification awaits that build (Kristof's side).