-
Notifications
You must be signed in to change notification settings - Fork 631
[rush] Upgrade pnpm-sync-lib
to v0.3.3 for pnpm v10 compatibility
#5254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[rush] Upgrade pnpm-sync-lib
to v0.3.3 for pnpm v10 compatibility
#5254
Conversation
b31e5f2
to
2985261
Compare
@iclanton Could you please review my code? Thank you! |
case '@pnpm/lockfile-file': { | ||
// The `@pnpm/lockfile-file` package requires `@pnpm/logger@^5.0.0`, but we are using `@pnpm/logger@1001.0.0`. | ||
packageJson.peerDependencies['@pnpm/logger'] = '*'; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gavinxgu unlike the above rules, this new rule seems to affect the dependency graph of the published Rush package. That would mean that the dependency versions being tested by our CI will be different from somebody who does npm install -g @microsoft/rush
, right? If so, is there a way to avoid this problem? (e.g. rush update --full
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@octogonz I've got an idea - similar to how Heft storybook kit does it, we can organize pnpm's internal packages by version into separate packages like rush-pnpm-kit-v8, rush-pnpm-kit-v9, and rush-pnpm-kit-v10. Then when we need to use different version-specific methods, we just import from the corresponding lib. This way we can avoid those unmet peerDeps issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@octogonz I've updated the implementation by introducing the concept of pnpm-kit to avoid unmet peer dependencies, and I've also cleaned up and refactored how the Rush repository references pnpm npm packages.
e13d10a
to
8790575
Compare
8790575
to
8055d31
Compare
tiktok/pnpm-sync#40
tiktok/pnpm-sync#43
Summary
Upgrade
pnpm-sync-lib
to v0.3.3 for pnpm v10 compatibilityDetails
1. Upgrade pnpm-sync-lib to Version 0.3.3
Updated
package.json
to upgrade pnpm-sync-lib from the previous version to 0.3.3, ensuring full compatibility with pnpm v10. This change builds upon the foundation established in tiktok/pnpm-sync#40 (pnpm v9 support) and tiktok/pnpm-sync#43 (pnpm v10 support).2. Adopt Official pnpm
readWantedLockfile
MethodsIntegrated official pnpm methods in
BaseInstallManager.ts
to support both v6 and v9 lockfile formats:This implementation provides backward compatibility while supporting the latest pnpm lockfile formats, with automatic detection based on lockfile version.
3. Enhanced Multi-Version pnpm Support
During the upgrade to pnpm v10, packages like
@pnpm/lockfile-file
and@pnpm/lockfile.fs
have peer dependency requirements for@pnpm/logger
, but these dependencies were not being properly satisfied, causing warnings or errors during installation.Solution Implementation
The solution leverages the
pnpm-kit
architecture - a set of version-specific wrapper packages that encapsulate pnpm functionality for different pnpm versions. As part of this upgrade, three new rush-pnpm-kit packages were added (@rushstack/rush-pnpm-kit-v8
,@rushstack/rush-pnpm-kit-v9
, and@rushstack/rush-pnpm-kit-v10
) to provide comprehensive support across pnpm versions. This modular approach allows Rush to support multiple pnpm versions simultaneously while ensuring proper dependency resolution.1. Adding @pnpm/logger as Direct Dependencies
@pnpm/logger
has been added as a direct dependency in eachpnpm-kit
package:libraries/rush-pnpm-kit-v8/package.json
libraries/rush-pnpm-kit-v9/package.json
libraries/rush-pnpm-kit-v10/package.json
2. Modular Encapsulation and Export
Each package exports similar modules with version-appropriate implementations:
3. Usage in Other Packages
In
libraries/rush-lib/src/logic/base/BaseInstallManager.ts
, different kit versions are imported to handle different lockfile formats:How it was tested
Impacted documentation