Skip to content

Update root workspace to pnpm 11#27307

Open
CraigMacomber wants to merge 15 commits into
microsoft:mainfrom
CraigMacomber:pnpm11
Open

Update root workspace to pnpm 11#27307
CraigMacomber wants to merge 15 commits into
microsoft:mainfrom
CraigMacomber:pnpm11

Conversation

@CraigMacomber
Copy link
Copy Markdown
Contributor

Description

Update root workspace to pnpm 11.

This is mostly based on the instructions in https://pnpm.io/migration

There was an additional fixup to deal with the trust policy exceptions for semver, see comment on it.
only-pnpm.cjs was crashing as well, so it was updated, and one of the 5 copies of it deduplicated.

The package.json file was migrated to use devEngines, but the pnpm entry in it was omitted as there does not seem to be a way to preserve that and keep the hash.

Note that npm will crash if used to install in this workspace (due to the workspace deps), and yarn will refuse to run due to the packageManager entry, so the only-pnpm script isn't really doing anything for this workspace.
It was kept as a bit of a redundent measure, and to be consistent with workspaces where it does matter.
That script was also reused from the compat-workspaces/full/package.json instead of duplicated.

Since this update was somewhat complex (a lot more changes than most pnpm updates), a limited change with just the root workspace is being done first.

Reviewer Guidance

The review process is outlined on this wiki page.

Copilot AI review requested due to automatic review settings May 13, 2026 18:58
Comment thread scripts/only-pnpm.cjs
╚══════════════════════════════════════════════════════════════════╝
`;

const used_pnpm = process.env.npm_config_user_agent.startsWith(`pnpm`);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crashed with pnpm 11 since npm_config_user_agent was undefined.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Hi! Thank you for opening this PR. Want me to review it?

Based on the diff (324 lines, 10 files), I've queued these reviewers:

  • Correctness — logic errors, race conditions, lifecycle issues
  • Security — vulnerabilities, secret exposure, injection
  • API Compatibility — breaking changes, release tags, type design
  • Performance — algorithmic regressions, memory leaks
  • Testing — coverage gaps, hollow tests

How this works

  • Adjust the reviewer set by ticking/unticking boxes above. Reviewer toggles alone don't trigger anything.

  • Tick Start review below to dispatch the review fleet.

  • After review finishes, tick Start review again to request another run — it auto-resets after each dispatch.

  • This comment updates as new commits land; your reviewer selections are preserved.

  • Start review

@alexvy86
Copy link
Copy Markdown
Contributor

I've seen a decent amount of patching of v11 for unexpected breaks, enough that it makes me want to wait another couple of weeks to give it time to bake before we use it.

Copy link
Copy Markdown
Contributor

@jason-ha jason-ha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love moving forward and getting the pnpm settings out of package.json so comments can be coupled.
If we do partial move, can multiple workspaces be worked on within the same enlistment? Or is there a pnpm switcher like nvm OR does corepack manage that automagically?

Comment thread pnpm-workspace.yaml
Comment on lines +175 to +184
patchedDependencies:
'@microsoft/api-extractor@7.58.1': patches/@microsoft__api-extractor@7.58.1.patch
# engineStrict: true
frozenLockfile: true
strictPeerDependencies: true
linkWorkspacePackages: true
# Disable pnpm update notifications since we use corepack to install package managers
updateNotifier: false
# Use the number of cores on the machine by default.
workspaceConcurrency: 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some blank lines above the top-level sections to improve readability?

Comment thread pnpm-workspace.yaml
#
# Guidelines for updating this file:
#
# 1. Keep the entries alphabetical wherever possible.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment meant to apply to top-level entries as well? I suspect that it may be good to have sections of top-level entries; so, these guidelines could be updated. Otherwise, at least sort the new content.

Comment thread pnpm-workspace.yaml Outdated
- '@aws-sdk/*'
patchedDependencies:
'@microsoft/api-extractor@7.58.1': patches/@microsoft__api-extractor@7.58.1.patch
# engineStrict: true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is up with engineStrict?
I see that it was present in .npmrc.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a bunch of at least some what redundant systems for enforcing what tools we use (package manager and node version). As I removed engines in favor of devEngines, this had no effect. Unfortunately, as far as I can tell now that I test it, devEngines is the right thing to use, except it doesn't work, so I put back the engines workaround and restored engines strict here.

Comment thread .npmrc Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we ever want this checked in again? If not, then can we add it to .gitignore? If we do that, then there may be some git status checks that can be cleaned up - currently it is common for changed files but exclude .npmrc in pipelines as it has temp auth tokens.

Comment thread package.json Outdated
"ci:build": "fluid-build --task ci:build",
"ci:build:docs": "fluid-build --task ci:build:docs",
"ci:check:are-the-types-wrong": "pnpm run -r --parallel --no-bail --color check:are-the-types-wrong",
"ci:check:are-the-types-wrong": "pnpm run -r --parallel --no-bail --color=auto check:are-the-types-wrong",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but what is going on?
Add note to PR description?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color takes an argument now, so this was parsing incorrectly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this was trying to opt in, so it now sets it to always.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants