feat(@sanity/plugin-kit)!: remove Studio v2 upgrade and compatibility tooling#1588
feat(@sanity/plugin-kit)!: remove Studio v2 upgrade and compatibility tooling#1588stipsan wants to merge 5 commits into
Conversation
… tooling Drop verify-studio and all verify-package checks that existed to migrate from or stay compatible with Sanity Studio v2 (incompatible-plugin shim, part:/config: imports, merged @sanity/* packages, sanity.json parts validation). Package verification now focuses on current plugin-kit conventions.
🦋 Changeset detectedLatest commit: e34a73c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… snapshots Remove the json5 dependency and readJson5File helper that only served v2 sanity.json parsing, prune stale eslint knip ignoreDependencies, and update verify-package snapshots after removing v2-upgrade checks.
Keep the Studio v2 upgrade/compat removals from this branch while integrating main's plugin-kit migration from prettier/eslint to oxfmt/oxlint. Drop the resurfaced verify-studio command and regenerate verify-package snapshots.
There was a problem hiding this comment.
Pull request overview
This PR ships a major update to @sanity/plugin-kit by removing Sanity Studio v2 upgrade/compatibility tooling (including the verify-studio command and v2-specific validations/fixtures), refocusing verify-package on current plugin-kit conventions for modern plugin packages.
Changes:
- Removes
verify-studioCLI/action and deletes v2 upgrade validations (v2 shim checks, v2 dependency checks, v2 manifest/parts handling). - Simplifies internals by removing v2 manifest utilities and dropping
json5/p-anydependencies. - Updates docs/tests/snapshots and deletes v2 studio fixtures accordingly; introduces a small Studio-config detection helper for
init/inject.
Reviewed changes
Copilot reviewed 52 out of 54 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Removes lock entries for dependencies dropped with v2 tooling. |
| packages/@sanity/plugin-kit/test/verify-package.test.ts | Updates verify-package tests and removes verify-studio coverage. |
| packages/@sanity/plugin-kit/test/init.test.ts | Removes init assertions that referenced v2 shim artifacts. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/tsconfig.json | Deletes v2 studio fixture file. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/static/.gitkeep | Deletes v2 studio fixture file. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/screening.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/schema.js | Deletes v2 studio fixture schema entrypoint. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/plotSummary.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/plotSummaries.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/person.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/movie.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/crewMember.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/castMember.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/schemas/blockContent.js | Deletes v2 studio fixture schema. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/sanity.json | Deletes v2 studio fixture manifest. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/README.md | Deletes v2 studio fixture README. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/plugins/.gitkeep | Deletes v2 studio fixture file. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/package.json | Deletes v2 studio fixture package.json. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/config/@sanity/vision.json | Deletes v2 studio fixture config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/config/@sanity/google-maps-input.json | Deletes v2 studio fixture config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/config/@sanity/form-builder.json | Deletes v2 studio fixture config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/config/@sanity/default-login.json | Deletes v2 studio fixture config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/config/@sanity/default-layout.json | Deletes v2 studio fixture config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/config/@sanity/data-aspects.json | Deletes v2 studio fixture config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/config/.checksums | Deletes v2 studio fixture config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/fresh-v2-movie-studio/.eslintrc | Deletes v2 studio fixture ESLint config. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/every-failure-possible/src/index.tsx | Updates fixture to remove v2 dependency/import references. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/every-failure-possible/sanity.json | Deletes v2 manifest from failure fixture. |
| packages/@sanity/plugin-kit/test/fixtures/verify-package/every-failure-possible/package.json | Updates failure fixture to remove v2 shim/deps expectations. |
| packages/@sanity/plugin-kit/test/snapshots/verify-package.test.ts.snap | Updates snapshots to match new messaging and removed v2 checks. |
| packages/@sanity/plugin-kit/src/util/readme.ts | Updates generated README links to monorepo plugin-kit docs. |
| packages/@sanity/plugin-kit/src/util/files.ts | Removes v2 manifest/JSON5-related helpers and dependencies. |
| packages/@sanity/plugin-kit/src/sanity/studio-detect.ts | Adds helper to detect studio config files for init/inject guards. |
| packages/@sanity/plugin-kit/src/sanity/manifest.ts | Removes v2 sanity.json manifest handling utilities. |
| packages/@sanity/plugin-kit/src/npm/package.ts | Removes v2 path validation logic; simplifies package path validation. |
| packages/@sanity/plugin-kit/src/constants.ts | Removes v2 migration/incompatible-plugin URLs and constants. |
| packages/@sanity/plugin-kit/src/configs/buildExtensions.ts | Removes v2 build extension list (previously used by v2 manifest checks). |
| packages/@sanity/plugin-kit/src/configs/banned-packages.ts | Removes v2 merged @sanity/* package list checks. |
| packages/@sanity/plugin-kit/src/cmds/verify-studio.ts | Removes verify-studio CLI command implementation. |
| packages/@sanity/plugin-kit/src/cmds/verify-package.ts | Updates verify-package CLI description to be convention-focused. |
| packages/@sanity/plugin-kit/src/cmds/inject.ts | Switches studio detection import to new helper and updates messaging. |
| packages/@sanity/plugin-kit/src/cmds/init.ts | Switches studio detection import to new helper and removes v2 sanity.json root checks. |
| packages/@sanity/plugin-kit/src/cmds/index.ts | Removes verify-studio command registration. |
| packages/@sanity/plugin-kit/src/cli.ts | Updates top-level CLI help to remove verify-studio and v3-upgrade language. |
| packages/@sanity/plugin-kit/src/actions/verify/verify-common.ts | Removes v2-related verify keys and updates error messaging. |
| packages/@sanity/plugin-kit/src/actions/verify/validations.ts | Deletes v2 dependency/studio-config/incompatible-plugin validations. |
| packages/@sanity/plugin-kit/src/actions/verify/types.ts | Removes v2 sanity.json-related types. |
| packages/@sanity/plugin-kit/src/actions/verify-studio.ts | Removes verify-studio action. |
| packages/@sanity/plugin-kit/src/actions/verify-package.ts | Removes v2 validations and updates error/success messaging. |
| packages/@sanity/plugin-kit/README.md | Removes verify-studio docs and v2 upgrade guidance; updates wording. |
| packages/@sanity/plugin-kit/package.json | Drops json5 and p-any dependencies. |
| packages/@sanity/plugin-kit/docs/semver-workflow.md | Removes v2/v3-branch upgrade guidance from preset manual steps. |
| .changeset/plugin-kit-drop-v2-upgrade.md | Adds major changeset documenting removal of v2 tooling. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 84f78bd. Configure here.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 54 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (2)
packages/@sanity/plugin-kit/src/sanity/studio-detect.ts:13
- findStudioConfig only detects sanity.config.(js|ts). That means init/inject can mistakenly run inside a v2 Studio (which typically has sanity.json with root:true) or a Studio that only has sanity.cli.(js|ts), since neither will be detected. Consider expanding detection to include sanity.cli.(js|ts) and sanity.json (root:true) to avoid clobbering Studio projects.
export async function findStudioConfig(basePath: string) {
const jsFile = 'sanity.config.js'
const jsExists = await fileExists(path.join(basePath, jsFile))
if (jsExists) {
return {configFile: jsFile}
packages/@sanity/plugin-kit/src/npm/package.ts:148
- validatePaths currently treats only paths under a directory literally named "dist" as "compiled" and skips existence checks for those. plugin-kit supports configurable output directories via package.config (dist: ), so packages using a non-"dist" outDir will fail validation even though the entry points are expected to exist only after build.
// Compiled entry points are expected to exist only after a build; skip existence checks for
// paths under dist-like directories. Otherwise require the file to be present.
const absolutePath = abs(manifestValue)
const looksCompiled =
absolutePath.includes(`${path.sep}dist${path.sep}`) ||
…nd studio detection Drop the dist-hardcoded path existence check in getPackage entirely: compiled entry points legitimately don't exist pre-build regardless of outDir, and verify-package's esmOnly check already bans main/module fields. Also detect sanity.cli.(js|ts) in findStudioConfig so init/inject refuse cli-config-only studio directories too.
| "inlinedDependencies": { | ||
| "@sanity/client": "7.23.2", | ||
| "@sanity/client": "7.24.0", | ||
| "rxjs": "7.8.2" |

Summary
Remove Sanity Studio v2 upgrade and compatibility features from
@sanity/plugin-kitas a new major.Merged with latest
main(including the oxfmt/oxlint migration). Conflicts were resolved by keeping this branch’s v2-removal intent and integrating main’s formatter/linter changes.Breaking changes
verify-studioCLI command (was only for upgrading v2 studios)verify-packagechecks for:@sanity/incompatible-plugin/v2-incompatible.js/sanity.jsonshim (incompatiblePlugin)@sanity/*v2 packages (dependencies)eslintImports(replaced on main by oxlint config checks)studioConfigtoggle (studio-only)sanity.json/ parts validation and related helpersStill included in
verify-packageESM-only packaging,
@sanity/pkg-utils, scripts, engines, tsconfig, babel leftovers, deprecated build tools, bannedsrcinfiles, plus the new oxfmt/oxlint config checks from main.Test plan
origin/mainand resolved conflictspnpm format/pnpm lint/pnpm knippnpm test -u -- packages/@sanity/plugin-kit(924 tests passed)