Skip to content

Conversation

@denolfe
Copy link
Member

@denolfe denolfe commented Dec 10, 2025

Overview

Migrates Payload monorepo from pnpm.overrides to pnpm catalogs for centralized dependency version management. This is Phase 1 of a two-phase migration, focusing on the 8 dependencies currently in overrides.

Key Changes

  • Add pnpm catalog to pnpm-workspace.yaml

    • 8 shared dependencies: copyfiles, cross-env, dotenv, graphql, mongodb-memory-server, react, react-dom, typescript

    Single source of truth for version management across workspace packages.

  • Update 9 package.json files to use catalog: protocol

    • Root, test, and 7 workspace packages now reference catalog instead of hardcoded versions
    • Removed pnpm.overrides block from root package.json
  • Fix prod test setup for --ignore-workspace

    • setupProd.ts now resolves catalog: entries to actual versions before running pnpm i --ignore-workspace

    The --ignore-workspace flag ignores all workspace config including catalogs, so entries must be resolved beforehand.

Design Decisions

Catalog over overrides: pnpm.overrides forces versions on all transitive dependencies. Catalogs provide explicit opt-in version sharing via catalog: protocol - cleaner and more intentional.

Minimal scope (Phase 1): Only migrated the 8 existing override dependencies. Phase 2 will audit and expand to commonly-duplicated deps like next, drizzle-orm, etc.

peerDependencies unchanged: Packages like @payloadcms/ui keep wide version ranges (e.g., "react": "^19.0.1 || ^19.1.2 || ^19.2.1") for consumer compatibility.

No external YAML parser: setupProd.ts uses simple string parsing to extract catalog entries, avoiding new dependencies.

Overall Flow

sequenceDiagram
    participant Root as pnpm-workspace.yaml
    participant Pkg as package.json files
    participant Install as pnpm install
    participant Pack as pnpm pack

    Root->>Root: Define catalog versions
    Pkg->>Pkg: Reference via "catalog:"
    Install->>Root: Resolve catalog: to versions
    Install->>Pkg: Install resolved versions
    Pack->>Pkg: Replace catalog: with actual versions in tarball
Loading

References / Links

- Add catalog section to pnpm-workspace.yaml with 8 shared deps
- Update 9 package.json files to use catalog: protocol
- Remove pnpm.overrides from root package.json
- Deps: copyfiles, cross-env, dotenv, graphql, mongodb-memory-server,
  react, react-dom, typescript
@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

📦 esbuild Bundle Analysis for payload

This analysis was generated by esbuild-bundle-analyzer. 🤖
This PR introduced no changes to the esbuild bundle! 🙌

--ignore-workspace ignores all workspace config including catalogs.
Replace catalog: entries with actual versions in test/package.json
during setupProd so pnpm install succeeds without workspace context.
Re-introduce pnpm.overrides using catalog: protocol to force
transitive dependencies to catalog versions while keeping
catalog as single source of truth.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants