Skip to content

[rush] Clean up PNPM options saving#5874

Open
iclanton wants to merge 5 commits into
microsoft:mainfrom
iclanton:clean-up-pnpm-options-saving
Open

[rush] Clean up PNPM options saving#5874
iclanton wants to merge 5 commits into
microsoft:mainfrom
iclanton:clean-up-pnpm-options-saving

Conversation

@iclanton

Copy link
Copy Markdown
Member

Summary

Cleanup of the PNPM common/temp/package.json and pnpm-workspace.yaml generation code, plus a bug fix uncovered during the cleanup.

Changes

  • InstallHelpers: Refactored generateCommonPackageJson into an async generateCommonPackageJsonAsync. The pnpm section of the common package.json is now assembled once from a destructured set of options, relying on JsonFile.saveAsync({ ignoreUndefinedValues: true }) to drop unset fields instead of conditionally assigning each property. Optional-chaining cleanups in getPackageManagerEnvironment.
  • BaseWorkspaceFile / PnpmWorkspaceFile: save is now saveAsync, and serialize is now serializeAsync. The catalogs, allowBuilds, minimumReleaseAge, and minimumReleaseAgeExclude setters were replaced with public fields. js-yaml is now imported dynamically.
  • WorkspaceInstallManager: Destructures the PNPM options up front and defers the js-yaml import.
  • Bug fix: Restored the workspaceFile.catalogs assignment that was accidentally dropped during the cleanup, so globalCatalogs are written to pnpm-workspace.yaml again.
  • Explicitly-set empty catalogs/allowBuilds objects are now passed through to the generated file as-is; only undefined values are omitted.

Testing

  • PnpmWorkspaceFile and InstallHelpers unit tests updated for the async API and the empty-object passthrough behavior. All tests pass.

iclanton added 4 commits July 15, 2026 19:27
… objects

- Restore workspaceFile.catalogs assignment in WorkspaceInstallManager that was lost during cleanup, so globalCatalogs are written to pnpm-workspace.yaml again
- Pass through explicitly-set empty catalogs/allowBuilds objects rather than omitting them; only undefined is omitted
- Update tests and snapshot to reflect the passthrough behavior
@iclanton iclanton enabled auto-merge (squash) July 16, 2026 00:58
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.

1 participant