Skip to content

docs: require the pnpm catalog for shared deps + enable catalogMode#1374

Open
stipsan wants to merge 2 commits into
mainfrom
cursor/catalog-dependency-policy-a424
Open

docs: require the pnpm catalog for shared deps + enable catalogMode#1374
stipsan wants to merge 2 commits into
mainfrom
cursor/catalog-dependency-policy-a424

Conversation

@stipsan

@stipsan stipsan commented Jun 22, 2026

Copy link
Copy Markdown
Member

What & why

Follow-up to the catalog migration: make "shared deps live in the catalog" the standing policy so the catalog doesn't drift back over time.

Two complementary pieces:

  1. AGENTS.md guideline — documents the rule: when a dependency is used by more than one package (two or more), manage its version in the pnpm catalog: and reference it with catalog: from each package.json, with named catalogs for cases that need a different major (shared studio peers use the existing catalog:peer named catalog).

  2. pnpm-workspace.yamlcatalogMode: prefer — the native pnpm setting. With prefer, pnpm add <dep> automatically reuses a dependency's catalog version when it already exists in a catalog, instead of writing a fresh literal range.

Merge note

main already landed catalogMode: prefer (and the reorganized nearby settings / minimumReleaseAge: 1440) while this PR was open. The merge conflict in pnpm-workspace.yaml was a simple overlap: both sides wanted catalogMode: prefer. Resolution kept main's surrounding settings and retained a short comment explaining why catalogMode is set. The AGENTS.md "Catalog shared dependencies" section was also tweaked post-merge so it doesn't contradict main's newer catalog:peer peer-deps guidance.

Why not enforce purely in pnpm?

pnpm has no native "used N times" threshold. catalogMode only governs pnpm add:

  • prefer (chosen) — reuse catalog versions when present; fall back to a direct dep otherwise. Non-disruptive.
  • strict — error if a dep isn't in the catalog. Too aggressive for a monorepo with many single-use deps.

So the threshold rule itself is documented in AGENTS.md, with catalogMode: prefer as the automated nudge.

Notes

  • Used the two-or-more-packages threshold to match the existing catalog (which already contains deps shared by exactly two packages).
  • No changeset: docs + workspace install setting only; no published package changes.

Verification

  • ✅ Merge conflict resolved; working tree clean.
  • pnpm install --frozen-lockfile — succeeds after merge.
Open in Web Open in Cursor 

@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 4ab9dad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes changesets to release 4 packages
Name Type
@sanity/assist Patch
sanity-plugin-internationalized-array Patch
@sanity/document-internationalization Patch
@sanity/sfcc Patch

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Jun 22, 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 17, 2026 4:09pm

Request Review

@stipsan stipsan added the 🤖 bot label Jun 22, 2026 — with Cursor
@stipsan
stipsan marked this pull request as ready for review July 17, 2026 15:54
@stipsan
stipsan requested a review from a team as a code owner July 17, 2026 15:54
@stipsan
stipsan requested review from Copilot and pedrobonamin and removed request for a team July 17, 2026 15:54

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

Documents and nudges consistent use of pnpm catalogs for shared dependency versions, to prevent version drift across packages in the monorepo.

Changes:

  • Adds catalogMode: prefer to pnpm-workspace.yaml so pnpm add reuses existing catalog versions automatically.
  • Updates AGENTS.md with a guideline: dependencies used by 2+ packages should be versioned via the pnpm catalog and referenced with catalog:.

Reviewed changes

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

File Description
pnpm-workspace.yaml Enables catalogMode: prefer to reduce accidental divergence from cataloged dependency versions.
AGENTS.md Documents the “shared deps go in the catalog” policy and how to use default vs named catalogs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AGENTS.md Outdated
Comment on lines +416 to +418
1. Add the dependency and its version range to the default `catalog:` in `pnpm-workspace.yaml`.
2. Reference it from each `package.json` as `"dep-name": "catalog:"`.
3. If one package must stay on a different major than the rest, add a named catalog (e.g. `catalogs.date-fns-v2`) and reference it with `catalog:<name>`.
…ency-policy-a424

# Conflicts:
#	pnpm-workspace.yaml

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 3 out of 3 changed files in this pull request and generated 1 comment.

Comment on lines 1 to 3
---
'@sanity/assist': patch
"@sanity/assist": patch
---
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