Skip to content

Migrate from npm to pnpm workspaces with catalogs - #43922

Merged
Timothee Guerin (timotheeguerin) merged 84 commits into
mainfrom
timotheeguerin/pnpm-workspaces
Sep 16, 2026
Merged

Timothee Guerin (timotheeguerin) merged 84 commits into
mainfrom
timotheeguerin/pnpm-workspaces

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Converts the repository from npm to pnpm workspaces with catalogs for shared dependency version management.

Changes

New files

  • pnpm-workspace.yaml — defines workspace packages, allowBuilds, overrides, and a catalog with 21 shared dependency versions
  • pnpm-lock.yaml — replaces package-lock.json

Package management

  • All file: references replaced with workspace:* protocol
  • Common dependency versions (typescript, prettier, vitest, eslint, etc.) centralized in catalog
  • Each workspace package uses catalog: instead of hardcoded versions
  • overrides moved from root package.json to pnpm-workspace.yaml (pnpm 11 requirement)
  • Added packageManager: "pnpm@11.5.1" to root package.json

CI/CD

  • Added pnpm/action-setup@v6 to the setup action
  • Changed cache from npm to pnpm
  • Replaced all npm ci → pnpm install --frozen-lockfile
  • Replaced all npm exec --no -- → pnpm exec
  • Replaced all npm run → pnpm run in workflows

Workspace packages (15 total)

  • Root, .github/, .github/shared/, eng/tools/, and all 11 sub-packages under eng/tools/

Verification

  • pnpm install ✅
  • eng/tools TypeScript build ✅
  • .github/shared build + tests (100% coverage) ✅
  • tsp compile on sample spec ✅

Notes

  • lint-diff's marked bumped from ^17 → ^18 (unified via catalog)
  • Added @types/js-yaml to packages that relied on npm's flat hoisting
  • eng/common/tsp-client and eng/common/spelling remain independent (not workspace packages)

- Add pnpm-workspace.yaml defining 15 workspace packages and a catalog
  with 21 shared dependency versions
- Replace file: references with workspace:* protocol
- Replace hardcoded versions with catalog: for shared deps
- Move overrides from package.json to pnpm-workspace.yaml
- Update all GitHub workflows and actions to use pnpm
- Add pnpm/action-setup@v4 to CI setup action
- Delete package-lock.json, generate pnpm-lock.yaml
- Add packageManager field to root package.json
@github-actions

github-actions Bot commented Jun 11, 2026 •

Copy link
Copy Markdown

Next Steps to Merge

Next steps that must be taken to merge this PR:
  • ❌ The required check named Protected Files has failed. Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the aka.ms/ci-fix guide


Comment generated by summarize-checks workflow run.

pnpm/action-setup runs before actions/setup-node, so it would try
to install pnpm using the runner's default Node 20 which is too old
for pnpm 11. Using standalone mode downloads a self-contained binary.
…orkspaces

# Conflicts:
#	eng/tools/typespec-validation/package.json
#	eng/tools/typespec-validation/src/rules/npm-prefix.ts
#	eng/tools/typespec-validation/test/npm-prefix.test.ts
#	package-lock.json
…orkspaces

# Conflicts:
#	eng/tools/lint-diff/package.json
#	package-lock.json
…into timotheeguerin/pnpm-workspaces

# Conflicts:
#	.github/package-lock.json
#	.github/package.json
…ification

The real speedup came from package-manager-cache: false (no ~3s pnpm probe) and switching to 'pnpm install --frozen-lockfile'. Removing --config.trust-lockfile=true restores pnpm's per-install supply-chain (minimumReleaseAge) verification on this step too, for full defense-in-depth at a small time cost.
…orkspaces

# Conflicts:
#	eng/tools/package.json
#	package-lock.json
…orkspaces

# Conflicts:
#	package-lock.json
#	package.json
…orkspaces

# Conflicts:
#	package-lock.json
#	package.json
…orkspaces

# Conflicts:
#	package-lock.json
#	package.json
…orkspaces

# Conflicts:
#	.devcontainer/devcontainer.json
#	.github/package-lock.json
#	.github/shared/package-lock.json
#	eng/tools/lint-diff/package.json
#	eng/tools/package.json
#	eng/tools/spec-gen-sdk-runner/package.json
#	eng/tools/typespec-requirement/package.json
#	package-lock.json
#	package.json
# to this command: pnpm does not read trustLockfile from the npm_config_* env, and
# the full installs in other workflows should keep verifying.
install-command: "pnpm install --frozen-lockfile --prod --prefer-offline --config.trust-lockfile=true --filter=azure-rest-api-specs-github..."
# Minimal prod-only install (~22 packages). Skip the pnpm store cache: in CI

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.

This is fine for now, but another factor is reliability. If the cache is more reliable, it might be better overall, even if slower (and how much slower?).

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