feat: read catalog configs from workspace manifest (feature flagged)#8019
feat: read catalog configs from workspace manifest (feature flagged)#8019
Conversation
| // Disable catalogs config reads by default until the overall feature is ready. | ||
| const isCatalogsConfigEnabled = opts?.catalogs ?? false | ||
| if (!isCatalogsConfigEnabled && typeof manifest === 'object' && manifest != null) { | ||
| delete (manifest as { catalog?: unknown }).catalog | ||
| delete (manifest as { catalogs?: unknown }).catalogs | ||
| } |
There was a problem hiding this comment.
The intention of feature flagging this was to prevent validation errors if users attempted to define catalogs today. I think a user would reasonably assume catalogs were ready as an overall feature if pnpm validated its config, but that's not true today.
| } | ||
|
|
||
| for (const [alias, specifier] of Object.entries(manifest.catalog)) { | ||
| if (typeof specifier !== 'string') { |
There was a problem hiding this comment.
I briefly considered supporting integers. For example:
catalog:
react: 18While I'd personally use ^18.3.0, 18 is technically a valid specifier. Currently the above would throw and users would have to write:
catalog:
react: "18"I think we should support plain integers as strings. Does that seem reasonable? I can do that in a following PR if so.
There was a problem hiding this comment.
no, let's only support it as string. Otherwise it becomes confusing as 18.10 isn't bigger than 18.2 according to semver.
There was a problem hiding this comment.
I definitely wouldn't support floats for the reason you mentioned. But yeah, even supporting just integers becomes a slippery slope. Okay, let's just do strings. 🙂
…8019) * refactor: move InvalidWorkspaceManifestError to its own file * feat: read catalogs config from workspace manifest * feat: disable catalogs config reads by default * chore: add changeset for new catalog config parsing
Changes
Part of #7072.
This PR reads pnpm catalogs in
WorkspaceManifestand adds type definitions for them. Future pull requests will read from this config.The changes are feature flagged for now to prevent the catalogs feature from being accidentally used before it's fully implemented.
Next
The next PR is #8020, but I'll leave that in draft mode until this PR merges.