Skip to content

[rush] Consolidate pnpm options handling into InstallHelpers.resolvePnpmSettings#5880

Merged
iclanton merged 7 commits into
microsoft:mainfrom
iclanton:more-install-helpers-cleanup
Jul 17, 2026
Merged

[rush] Consolidate pnpm options handling into InstallHelpers.resolvePnpmSettings#5880
iclanton merged 7 commits into
microsoft:mainfrom
iclanton:more-install-helpers-cleanup

Conversation

@iclanton

Copy link
Copy Markdown
Member

Summary

Consolidates how Rush interprets the pnpm options when generating the install files, so the options are read and version-gated in a single place instead of being duplicated across the install managers. This is intended to be a behavior-preserving refactor.

Details

  • Adds InstallHelpers.resolvePnpmSettings(...) — the single place that reads a subspace's pnpm options, emits the version-compatibility warnings, and derives both:
    • the pnpm field written to common/temp/package.json, and
    • a PnpmWorkspaceFile (common/temp/pnpm-workspace.yaml) populated with the version-gated settings (overrides, packageExtensions, peerDependencyRules, allowedDeprecatedVersions, patchedDependencies, allowBuilds, catalogs, minimumReleaseAge, etc.).
  • generateCommonPackageJsonAsync now just consumes the resolved settings rather than re-reading and re-gating the pnpm options itself. WorkspaceInstallManager and RushInstallManager both route through resolvePnpmSettings, removing the duplicated pnpm 11 gating logic that previously lived in two places.
  • Adds a RushConstants.pnpmWorkspaceFileName constant and replaces the hard-coded 'pnpm-workspace.yaml' strings.
  • Adds PnpmWorkspaceFile.loadAsync(...), which reads and parses pnpm-workspace.yaml once and returns a populated instance. The rush-pnpm patch-commit/patch-remove and approve-builds commands now use it, replacing the previous per-field loaders / inline YAML parsing.

How it was tested

  • heft test for rush-lib (703 tests passing).
  • The rush-lib API report (common/reviews/api/rush-lib.api.md) is updated accordingly.

iclanton added 5 commits July 16, 2026 20:09
…npmSettings

Read the pnpm options in a single place that derives both the common package.json "pnpm" field and a populated PnpmWorkspaceFile, removing the duplicated pnpm-version gating between generateCommonPackageJsonAsync and WorkspaceInstallManager.prepareCommonTempAsync.
Replace the per-field loadPatchedDependenciesAsync/loadAllowBuildsAsync helpers with a single loadAsync that parses the file once and returns a populated PnpmWorkspaceFile, and use it from the rush-pnpm patch-commit and approve-builds commands.
@iclanton
iclanton enabled auto-merge (squash) July 17, 2026 22:25
@iclanton
iclanton merged commit 656f538 into microsoft:main Jul 17, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Needs triage to Closed in Bug Triage Jul 17, 2026
@iclanton
iclanton deleted the more-install-helpers-cleanup branch July 18, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

2 participants