Skip to content

feat: let create-prisma target a specific Prisma Next release#40

Merged
AmanVarshney01 merged 3 commits into
aman/create-prisma-nextfrom
tml-2692-create-prisma-accept-prisma-next-version-to-target-a
May 27, 2026
Merged

feat: let create-prisma target a specific Prisma Next release#40
AmanVarshney01 merged 3 commits into
aman/create-prisma-nextfrom
tml-2692-create-prisma-accept-prisma-next-version-to-target-a

Conversation

@wmadden
Copy link
Copy Markdown

@wmadden wmadden commented May 27, 2026

After this PR, you can scaffold against an exact Prisma Next version through the canonical entry point:

create-prisma --name my-app --template hono --prisma-next-version 0.10.0
# every @prisma-next/* dep in package.json pinned to 0.10.0
# `prisma-next init` invoked as `npx --yes prisma-next@0.10.0 init …`
# agent skills resolved from prisma/prisma-next/skills#v0.10.0

Closes TML-2692.

Why

create-prisma@next hard-codes the Prisma Next dependency spec to "latest". The moment a new Prisma Next version ships, the previous one becomes unreachable through the canonical scaffold path, which means we cannot reproduce user-filed issues against the exact version they were filed on, smoke-test release candidates before they get the latest tag, or dogfood open PRs end-to-end. The onboarding audit needs all three.

What <spec> accepts

The simplest case is a published version, used for regression and bisect work:

create-prisma --prisma-next-version 0.10.0
create-prisma --prisma-next-version 0.11.0-dev.9

The next is an npm dist-tag, used to smoke-test release candidates before they get the latest tag:

create-prisma --prisma-next-version dev   # or `next`, `canary`, …

These two cases work uniformly across every supported package manager (npm, pnpm, yarn, bun, deno) and across the existing skill-install path: prisma-next init already derives the skills ref from the installed CLI's package.json#version, so installing @prisma-next/cli@0.10.0 automatically pulls prisma/prisma-next/skills#v0.10.0.

The third case is a pkg.pr.new ref, used to dogfood open PRs:

create-prisma --prisma-next-version pkg-pr-new:bad6795
# rewrites every @prisma-next/* install to
# https://pkg.pr.new/prisma/prisma-next/<package>@bad6795

This case is partial in this PR — see Scope below.

Omitting the flag preserves today's behaviour exactly.

What changed under the hood

The Prisma Next version is no longer a module-level constant. It's a ResolvedPrismaNextSpec produced once at startup by parsePrismaNextVersionSpec(input.prismaNextVersion) and threaded through PrismaSetupContext, the dep-writing helpers, and the prisma-next init invocation. The two helpers that previously hard-coded \"latest\" now take the resolved spec and emit either name@<spec> or the pkg.pr.new URL form — package managers accept URL specifiers in both install argv and package.json, so the URL flows through unchanged.

Telemetry on the create command gains prisma-next-version-kind (default | npm-tag | npm-version | pkg-pr-new) and the verbatim prisma-next-version-spec, so the audit can see which escape hatch users reach for.

Scope of this PR

Cases 1 and 2 (version pin, dist-tag) ship end-to-end across every package manager. Acceptance criteria from TML-2692 met: pinned scaffold has every @prisma-next/* and prisma-next dep at the requested version, the init invocation uses the same version, skills resolve from the matching tag.

Case 3 (pkg.pr.new) ships partially. The URL form is emitted everywhere it should be, including package.json deps for every package manager. The npx --yes <URL> init path works end-to-end on npm. Two follow-ups are needed to make case 3 fully usable:

  • TML-2694prisma-next init needs a PRISMA_NEXT_SKILLS_REF env-var override so the skills ref can be derived from a SHA rather than a v<version> git tag (which doesn't exist for pkg.pr.new tarballs).
  • TML-2695bunx <URL>, pnpm dlx <URL>, yarn dlx <URL>, and deno run npm:<URL> don't accept URL specifiers the way npx does. Non-npm package managers need a two-step (install-then-local-bin) shape for the init invocation when the spec is pkg.pr.new.

Both are flat tickets in [PN] Onboarding Audit, related to TML-2692.

Test plan

bun run test:unit covers the spec parser, the threading from the new flag down to package.json writes (including the pkg.pr.new URL form for every Prisma Next dep), and the telemetry classifier across all four kinds (31 tests, including a regression test that the default path still writes \"latest\"). Smoke-tested against the built CLI for the default path, --prisma-next-version 0.10.0 with --package-manager bun, and --prisma-next-version pkg-pr-new:<ref> with --package-manager npm.

Alternatives considered

  • Keep PRISMA_NEXT_PACKAGE_VERSION as a module-level mutable singleton that the CLI entry sets once. Smaller diff than the threaded approach, but create-prisma also exports a programmatic create() API; a mutable singleton becomes racy if anyone ever calls it twice in the same process with different specs. Explicit threading keeps the helpers pure and the version a property of a request, not of the process.
  • Ship all three cases in this PR by resolving pkg.pr.new refs to SHAs at scaffold time and shipping the bunx/dlx/deno workarounds inline. Doable, but the SHA resolution introduces a network dependency at scaffold time, and the workaround for non-npm runtimes is non-trivial. The ticket explicitly classed case 3 as stretch and called out filing the prisma-next-side change as a separate follow-up; doing the same on the create-prisma side keeps this PR small and unblocks cases 1+2 immediately.
  • Validate the spec string against a semver grammar before passing it through. Rejected because dist-tags (dev, next, …) and prereleases (0.11.0-dev.9) must round-trip unchanged; npm itself doesn't validate tag syntax, and over-validating in create-prisma would lock us out of tags Prisma Next may introduce later.

wmadden added 3 commits May 27, 2026 15:51
Introduce ResolvedPrismaNextSpec + parsePrismaNextVersionSpec so the
target Prisma Next version is no longer a module-level constant. The
parser recognises pkg-pr-new:<ref> specs alongside npm versions and
dist-tags; getPrismaNextPackageSpecifier and getDependencyVersion now
accept the resolved spec and emit either name@<spec> or the
https://pkg.pr.new/prisma/prisma-next/<name>@<ref> URL form that
package managers accept directly.

No call sites pass a non-default spec yet; the new shape is what the
upcoming --prisma-next-version flag will thread through.
Add the --prisma-next-version flag and plumb the resolved Prisma Next
spec into PrismaSetupContext, writePrismaDependencies,
writeCreateTemplateDependencies, and the prisma-next init invocation.
Every @prisma-next/* and prisma-next dependency written into
package.json — and the npx/dlx/bunx prisma-next@<spec> init command —
now honours the spec. With no flag, behaviour is unchanged (latest).

Supported specs:
- a published npm version (0.10.0, 0.11.0-dev.9, …) for regression /
  bisect work against the exact version a user filed an issue on;
- an npm dist-tag (latest, dev, next, …) for smoke-testing release
  candidates before they get the latest tag;
- pkg-pr-new:<sha|branch|pr-number> for dogfooding open PRs end-to-end
  through the canonical scaffold path — substitutes the
  https://pkg.pr.new/prisma/prisma-next/<package>@<ref> URL specifier
  for every Prisma Next install. Package managers accept URL specifiers
  in both install argv and package.json, so no special-casing per
  package manager is needed.

The pkg.pr.new path doesn't yet derive a matching skills ref (the
upstream prisma-next CLI needs a PRISMA_NEXT_SKILLS_REF override before
this is fully wired up); cases 1+2 work end-to-end today and unblock
the onboarding-audit regression workflows.
Add prisma-next-version-kind (default | npm-tag | npm-version |
pkg-pr-new) and prisma-next-version-spec to the create command's
completion / failure events. The kind is the low-cardinality signal
the onboarding audit needs to see which escape hatch users reach for;
the spec round-trips the exact string for the long tail of dist-tags,
prereleases, and PR refs that can't be summarised by the kind alone.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9e90ef46-d733-4869-b477-895cfdef0a80

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tml-2692-create-prisma-accept-prisma-next-version-to-target-a
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch tml-2692-create-prisma-accept-prisma-next-version-to-target-a

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

PR preview published

  • Version: 0.4.2-pr.40.103.1
  • Tag: pr40
  • Run with Bun: bunx create-prisma@pr40
  • Run with npm: npx create-prisma@pr40
  • Run with Yarn: yarn dlx create-prisma@pr40
  • Run with pnpm: pnpm dlx create-prisma@pr40
  • Run with Deno: deno run -A npm:create-prisma@pr40
  • Workflow run: https://github.com/prisma/create-prisma/actions/runs/26517244318

@wmadden wmadden changed the title feat: accept --prisma-next-version to target a specific Prisma Next release feat: let create-prisma target a specific Prisma Next release May 27, 2026
@AmanVarshney01 AmanVarshney01 merged commit 8eff31c into aman/create-prisma-next May 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants