Skip to content

Conversation

@aramissennyeydd
Copy link
Contributor

@aramissennyeydd aramissennyeydd commented Nov 25, 2025

Summary

Adds support for defining pnpm catalog values to pnpm-config.json. This makes updating versions across a monorepo way easier because you can specify a version once and it gets picked up in a bunch of other places.

Details

https://pnpm.io/9.x/catalogs, basically this allows using an alias for common versions to reduce the size of changesets that target global versions.

My goal is for this to resemble the existing pnpm options. Weirdly, this needs to be in the pnpm-workspace file and isn't supported as a package.json pnpm property.

How it was tested

Added unit tests.

Tested in our monorepo with a catalog: package for install/update and add. The catalog: specifier works for all 3, for install, a new catalog top level property is added into the lockfile and for add, if catalog: is the global version, add will automatically use it for new packages. I also tested that the temp shrinkwrap files still work, they use the resolved version in the specifier.

I will likely need a preview version to test this with publish to make sure it works there as well.

Impacted documentation

Not sure? Might need additional documentation where pnpm-options values are described.

Signed-off-by: Aramis Sennyey <[email protected]>
// See LICENSE in the project root for license information.

import * as path from 'node:path';
import { FileSystem } from '@rushstack/node-core-library';
Copy link
Contributor

Choose a reason for hiding this comment

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

How much more complicated would it be to mock FileSystem in these tests and avoid the disk accesses? Having unit tests modify the file system is very much an antipattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lmk what you think of 85c9e58 (#5467)

.:
dependencies:
react:
specifier: 'catalog:'
Copy link
Contributor

Choose a reason for hiding this comment

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

Since catalog: is just shorthand for catalog:default, should we prefer the latter for clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just for this example lockfile or more generally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

2 participants