fix: write pnpm overrides to pnpm-workspace.yaml#24918
Open
mcollovati wants to merge 3 commits into
Open
Conversation
Contributor
b64076e to
19e6b57
Compare
Recent pnpm versions no longer read the "pnpm" field from package.json, so the dependency overrides Flow generated there were silently ignored and pnpm logged a warning about it. As a result Flow could no longer lock transitive dependencies to the platform versions when using pnpm. Flow now writes these overrides to pnpm-workspace.yaml, the location pnpm actually reads, and moves any overrides left in package.json over to it. Existing user content in pnpm-workspace.yaml is preserved, and a Flow-generated file is cleaned up like other generated frontend files.
19e6b57 to
3c327df
Compare
platosha
requested changes
Jul 8, 2026
Override processing was split into `lockNpmOverrides` and `lockPnpmOverrides`, suggesting the two package managers were handled differently when in fact only the override storage format and location differ. `lockVersionForNpm` now manages overrides as a single canonical flat map and branches only to load and save them, delegating the format differences to an `OverridesStore` (nested `overrides` in package.json for npm, flat overrides in pnpm-workspace.yaml for pnpm). Behavior is unchanged.
platosha
requested changes
Jul 8, 2026
| assertNotNull(npmPackageJson.get(OVERRIDES), | ||
| "npm overrides must be written to package.json"); | ||
| assertTrue(npmPackageJson.get(OVERRIDES).has(TEST_DEPENDENCY), | ||
| "Managed override must be present in npm overrides"); |
Contributor
There was a problem hiding this comment.
This is maybe also expected to delete the obsolete pnpm-workspace.yaml, given that both conditions apply:
- overrides are migrated to the npm's
package.jsonconvention - there's no other user content besides overrides is in
pnpm-workspace.yaml
Collaborator
Author
There was a problem hiding this comment.
Could it be that the user added custom entries in the workspace file and wants to preserve them?
Is this a valid use case?
| "User packages section must be preserved"); | ||
| assertTrue(content.contains("shamefully-hoist"), | ||
| "User settings must be preserved"); | ||
| assertTrue(content.contains("dep"), "Override must be written"); |
Contributor
There was a problem hiding this comment.
In addition, let us assert that the user content is preserved after clearing overrides with workspace.setOverrides(Map.of());. Use case: migrating to npm.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Recent pnpm versions no longer read the "pnpm" field from package.json, so the dependency overrides Flow generated there were silently ignored and pnpm logged a warning about it. As a result Flow could no longer lock transitive dependencies to the platform versions when using pnpm.
Flow now writes these overrides to pnpm-workspace.yaml, the location pnpm actually reads, and moves any overrides left in package.json over to it. Existing user content in pnpm-workspace.yaml is preserved, and a Flow-generated file is cleaned up like other generated frontend files.