Skip to content

Commit 1974495

Browse files
kristof-siketclaude
andcommitted
Run the composer CLI from the repo's own install
npx prisma-composer@<v> 404s: the bin ships inside @prisma/composer and no package named prisma-composer exists. Prefer the local bin the install phase already provided; fall back to fetching the pinned package when the repo does not carry the CLI. Found by the first run past the credential guard, the one path the credential-less fixtures could not exercise. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 7a5e2bc commit 1974495

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

‎main.mjs‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,23 @@ if (!(process.env.PRISMA_SERVICE_TOKEN ?? "").trim()) {
141141

142142
// The stage reaches the argv array straight from the environment; it is
143143
// never interpolated into a shell string.
144-
const composer = `prisma-composer@${composerVersion}`;
145-
const composerArgs =
146-
mode === "deploy"
147-
? [composer, "deploy", modulePath, ...(stage ? ["--stage", stage] : [])]
148-
: [composer, "destroy", modulePath, "--stage", stage];
149-
150-
runPhase(mode, "npx", composerArgs);
144+
//
145+
// The CLI bin is named prisma-composer but ships inside @prisma/composer;
146+
// there is no npm package named prisma-composer, so `npx prisma-composer@v`
147+
// 404s. The repo's own install already provides the bin (the packages are in
148+
// its dependencies), so prefer the local bin; fall back to fetching the
149+
// pinned package only when the repo does not carry it.
150+
const localBin = join(workdir, "node_modules", ".bin", "prisma-composer");
151+
const [composerCmd, composerLead] = existsSync(localBin)
152+
? [localBin, []]
153+
: ["npx", [`--package=@prisma/composer@${composerVersion}`, "prisma-composer"]];
154+
const composerArgs = [
155+
...composerLead,
156+
...(mode === "deploy"
157+
? ["deploy", modulePath, ...(stage ? ["--stage", stage] : [])]
158+
: ["destroy", modulePath, "--stage", stage]),
159+
];
160+
161+
runPhase(mode, composerCmd, composerArgs);
151162
report("final", { outcome: "succeeded" });
152163
finish("succeeded");

0 commit comments

Comments
 (0)