[code-infra] Write version overrides to pnpm-workspace.yaml#1549
Conversation
Deploy previewBundle sizeTotal Size Change: 0B(0.00%) - Total Gzip Change: 0B(0.00%) Show details for 64 more bundles@mui/internal-docs-infra/abstractCreateDemo parsed: 0B(0.00%) gzip: 0B(0.00%) PerformanceTotal duration: 19.97 ms +1.84 ms(+10.1%) | Renders: 5 (+0) No significant changes — details Check out the code infra dashboard for more information about this PR. |
set-version-overrides wrote computed overrides into the root package.json resolutions field. Under pnpm 11 a pnpm-workspace.yaml overrides: block (which consumer repos already use) replaces the resolutions wholesale, so the requested pin was silently dropped and CI legacy-browser jobs no longer matched their Playwright image. Write the overrides into pnpm-workspace.yaml overrides: instead, preserving comments/anchors via the yaml document API. Reject a resolutions field outright and write where overrides already live, defaulting to the workspace file.
dc0d8fc to
fbb0643
Compare
Extract the manifest read/decide/write from the handler into writeOverridesToWorkspace and cover it with temp-dir fixtures, mirroring the build tool's disk-based tests (makeTempDir): preserving an existing pnpm-workspace.yaml, creating one when absent, writing to package.json pnpm.overrides, and rejecting resolutions without writing anything.
Merge the pure decision helper and its IO wrapper into a single function, parallelize the two independent manifest reads, and test the one layer through disk fixtures.
Drop the local readPackageJson and writeFile-for-package.json helpers in favor of the shared utils from pnpm.mjs.
It's a generic workspace-manifest helper, not command-specific glue, and pnpm.mjs already owns readPackageJson/writePackageJson. Tests move alongside it into pnpm.test.mjs.
| const rootPackageJson = await readPackageJson(workspaceDir); | ||
| const yamlSource = await yamlPromise; |
There was a problem hiding this comment.
| const rootPackageJson = await readPackageJson(workspaceDir); | |
| const yamlSource = await yamlPromise; | |
| const [rootPackageJson, yamlSource] = await Promise.all([readPackageJson(workspaceDir), yamlPromise]); |
Apply review suggestion from @brijeshb42.
set-version-overrideswrote overrides intopackage.jsonresolutions. Under pnpm 11, an existingpnpm-workspace.yamloverrides:block dropsresolutionswholesale, so pins were silently ignored and CI legacy-browser jobs stopped matching their Playwright image.Now writes to
pnpm-workspace.yamloverrides:(preserving comments/anchors via theyamldoc API), rejects aresolutionsfield, and writes where overrides already live. Override-computation logic unchanged.