Skip to content

fix: write pnpm overrides to pnpm-workspace.yaml#24918

Merged
platosha merged 4 commits into
mainfrom
fix/pnpm-11-workspace-overrides
Jul 21, 2026
Merged

fix: write pnpm overrides to pnpm-workspace.yaml#24918
platosha merged 4 commits into
mainfrom
fix/pnpm-11-workspace-overrides

Conversation

@mcollovati

Copy link
Copy Markdown
Collaborator

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.

@github-actions github-actions Bot added the +0.0.1 label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Test Results

 1 457 files  +1   1 457 suites  +1   1h 38m 55s ⏱️ -41s
10 314 tests +8  10 246 ✅ +8  68 💤 ±0  0 ❌ ±0 
10 786 runs  +8  10 717 ✅ +8  69 💤 ±0  0 ❌ ±0 

Results for commit 85dcde2. ± Comparison against base commit 1ac6a6e.

♻️ This comment has been updated with latest results.

@mcollovati
mcollovati force-pushed the fix/pnpm-11-workspace-overrides branch from b64076e to 19e6b57 Compare July 6, 2026 11:01
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.
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.
A `pnpm-workspace.yaml` may be authored and owned by the user, so an npm build
must not rewrite or delete it. Flow manages the file only while pnpm is in use;
switching to npm simply (re)writes the managed overrides to package.json and
leaves the workspace file as-is.

Add tests asserting the workspace file and its overrides survive a switch to
npm, and that clearing overrides via `PnpmWorkspaceFile` preserves any other
user content.
@sonarqubecloud

Copy link
Copy Markdown

@platosha
platosha added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 6d7bf86 Jul 21, 2026
35 checks passed
@platosha
platosha deleted the fix/pnpm-11-workspace-overrides branch July 21, 2026 11:16
@github-project-automation github-project-automation Bot moved this from 🔎Iteration reviews to Done in Vaadin Flow | Hilla | Kits ongoing work Jul 21, 2026
vaadin-bot added a commit that referenced this pull request Jul 21, 2026
…25020)

This PR cherry-picks changes from the original PR #24918 to branch 25.2.
---
#### Original PR description
> 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.
>

Co-authored-by: Marco Collovati <marco@vaadin.com>
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 25.3.0-alpha6.

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

Projects

Development

Successfully merging this pull request may close these issues.

3 participants