Skip to content

Better support sets of dependencies that should be on the same version in pnpm catalogs #8245

@gluxon

Description

@gluxon

Contribution

Describe the user story

The catalog: protocol allows developers to deduplicate dependency specifiers across different package.json files in a repo.

There are some sets of dependencies (typically ones published from a monorepo) that follow similar version schemes and ideally upgrade "together". For example, you generally want to keep react, react-dom, and react-is on the same version.

# pnpm-workspace.yaml

catalog:
  react: ^18.3.1
  react-dom: ^18.3.1
  react-is: ^18.3.1

Describe the solution you'd like

It would be convenient to offer some way to further deduplicate grouped sets of dependencies that all share the same version.

Wildcard

# pnpm-workspace.yaml
catalogs:
  react:
    '*': '^18.3.1

Referencing another entry:

# pnpm-workspace.yaml
catalog:
  react: ^18.3.1
  react-dom: catalog:default:react
  react-is: catalog:default:react

Describe the drawbacks of your solution

Both approaches make it harder to automatically upgrade dependencies through pnpm update. The pnpm update command's implementation would need to understand these grouped sets of dependencies share a version.

I'm not sure whether we should implement this feature yet, but wanted to drop down a feature request describing the problem and gauge whether we should solve it. Please 👍 if you think some solution to this would be valuable.

Describe alternatives you've considered

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions