feat: let create-prisma target a specific Prisma Next release#40
Merged
AmanVarshney01 merged 3 commits intoMay 27, 2026
Conversation
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.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
PR preview published
|
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.
After this PR, you can scaffold against an exact Prisma Next version through the canonical entry point:
Closes TML-2692.
Why
create-prisma@nexthard-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 thelatesttag, or dogfood open PRs end-to-end. The onboarding audit needs all three.What
<spec>acceptsThe simplest case is a published version, used for regression and bisect work:
The next is an npm dist-tag, used to smoke-test release candidates before they get the
latesttag: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 initalready derives the skills ref from the installed CLI'spackage.json#version, so installing@prisma-next/cli@0.10.0automatically pullsprisma/prisma-next/skills#v0.10.0.The third case is a pkg.pr.new ref, used to dogfood open PRs:
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
ResolvedPrismaNextSpecproduced once at startup byparsePrismaNextVersionSpec(input.prismaNextVersion)and threaded throughPrismaSetupContext, the dep-writing helpers, and theprisma-next initinvocation. The two helpers that previously hard-coded\"latest\"now take the resolved spec and emit eithername@<spec>or the pkg.pr.new URL form — package managers accept URL specifiers in both install argv andpackage.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 verbatimprisma-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/*andprisma-nextdep at the requested version, theinitinvocation 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.jsondeps for every package manager. Thenpx --yes <URL> initpath works end-to-end on npm. Two follow-ups are needed to make case 3 fully usable:prisma-next initneeds aPRISMA_NEXT_SKILLS_REFenv-var override so the skills ref can be derived from a SHA rather than av<version>git tag (which doesn't exist for pkg.pr.new tarballs).bunx <URL>,pnpm dlx <URL>,yarn dlx <URL>, anddeno run npm:<URL>don't accept URL specifiers the waynpxdoes. Non-npm package managers need a two-step (install-then-local-bin) shape for theinitinvocation when the spec is pkg.pr.new.Both are flat tickets in
[PN] Onboarding Audit, related to TML-2692.Test plan
bun run test:unitcovers the spec parser, the threading from the new flag down topackage.jsonwrites (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.0with--package-manager bun, and--prisma-next-version pkg-pr-new:<ref>with--package-manager npm.Alternatives considered
PRISMA_NEXT_PACKAGE_VERSIONas a module-level mutable singleton that the CLI entry sets once. Smaller diff than the threaded approach, butcreate-prismaalso exports a programmaticcreate()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.bunx/dlx/denoworkarounds 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.dev,next, …) and prereleases (0.11.0-dev.9) must round-trip unchanged; npm itself doesn't validate tag syntax, and over-validating increate-prismawould lock us out of tags Prisma Next may introduce later.