Skip to content

feat(@sanity/plugin-kit)!: remove Studio v2 upgrade and compatibility tooling#1588

Open
stipsan wants to merge 5 commits into
mainfrom
cursor/remove-plugin-kit-v2-upgrade-3878
Open

feat(@sanity/plugin-kit)!: remove Studio v2 upgrade and compatibility tooling#1588
stipsan wants to merge 5 commits into
mainfrom
cursor/remove-plugin-kit-v2-upgrade-3878

Conversation

@stipsan

@stipsan stipsan commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Remove Sanity Studio v2 upgrade and compatibility features from @sanity/plugin-kit as 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

  • Removed verify-studio CLI command (was only for upgrading v2 studios)
  • Removed verify-package checks for:
    • leftover @sanity/incompatible-plugin / v2-incompatible.js / sanity.json shim (incompatiblePlugin)
    • obsolete merged @sanity/* v2 packages (dependencies)
    • v2 import linting / eslintImports (replaced on main by oxlint config checks)
    • studioConfig toggle (studio-only)
  • Removed v2 sanity.json / parts validation and related helpers

Still included in verify-package

ESM-only packaging, @sanity/pkg-utils, scripts, engines, tsconfig, babel leftovers, deprecated build tools, banned src in files, plus the new oxfmt/oxlint config checks from main.

Test plan

  • Merged origin/main and resolved conflicts
  • pnpm format / pnpm lint / pnpm knip
  • pnpm test -u -- packages/@sanity/plugin-kit (924 tests passed)
Open in Web Open in Cursor 

… 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-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e34a73c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sanity/plugin-kit Major

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

@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview, Comment Jul 20, 2026 10:33am

Request Review

… 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.
@stipsan
stipsan marked this pull request as ready for review July 15, 2026 21:27
@stipsan
stipsan requested a review from a team as a code owner July 15, 2026 21:27
@stipsan
stipsan requested review from Copilot and juice49 and removed request for a team July 15, 2026 21:27
@stipsan
stipsan enabled auto-merge (squash) July 15, 2026 21:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-studio CLI/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-any dependencies.
  • 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.

Comment thread packages/@sanity/plugin-kit/src/npm/package.ts Outdated
Comment thread packages/@sanity/plugin-kit/src/sanity/studio-detect.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread packages/@sanity/plugin-kit/src/cmds/init.ts
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 27.6% 4268 / 15461
🔵 Statements 27.21% 4462 / 16394
🔵 Functions 22.71% 1054 / 4641
🔵 Branches 17.93% 1931 / 10766
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/@sanity/plugin-kit/package.json 100% 100% 100% 100%
packages/@sanity/plugin-kit/src/cli.ts 0% 0% 0% 0% 10-71
packages/@sanity/plugin-kit/src/constants.ts 100% 100% 100% 100%
packages/@sanity/plugin-kit/src/actions/verify/validations.ts 47.25% 47.45% 21.62% 48.48% 21-411
packages/@sanity/plugin-kit/src/actions/verify/verify-common.ts 21.42% 0% 0% 21.42% 38-75
packages/@sanity/plugin-kit/src/cmds/index.ts 0% 100% 0% 0% 3-15
packages/@sanity/plugin-kit/src/configs/banned-packages.ts 100% 100% 100% 100%
packages/@sanity/plugin-kit/src/npm/package.ts 3.36% 0% 0% 3.38% 43-362
packages/@sanity/plugin-kit/src/util/files.ts 17.74% 0% 21.05% 18.96% 28-136
packages/@sanity/plugin-kit/src/util/readme.ts 40% 27.77% 20% 40% 8-48, 61, 71-74, 81-88
Generated in workflow #7753 for commit e34a73c by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 53 out of 55 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment on lines 70 to 72
"inlinedDependencies": {
"@sanity/client": "7.23.2",
"@sanity/client": "7.24.0",
"rxjs": "7.8.2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants