Skip to content

Add support for pnpm v10#43

Merged
octogonz merged 1 commit intotiktok:mainfrom
gavinxgu:guxiang/pnpm-10
Jun 13, 2025
Merged

Add support for pnpm v10#43
octogonz merged 1 commit intotiktok:mainfrom
gavinxgu:guxiang/pnpm-10

Conversation

@gavinxgu
Copy link
Contributor

@gavinxgu gavinxgu commented Jun 10, 2025

  • Add pnpm v10 compatibility
  • Add multi-version pnpm testing to ensure cross-version compatibility

@gavinxgu gavinxgu force-pushed the guxiang/pnpm-10 branch 2 times, most recently from a1c50d7 to 00e3c4d Compare June 11, 2025 00:30
if (!pnpmVersion || !(pnpmVersion.startsWith('8') || pnpmVersion.startsWith('9'))) {
if (
!pnpmVersion ||
!(pnpmVersion.startsWith('8') || pnpmVersion.startsWith('9') || pnpmVersion.startsWith('10'))
Copy link
Member

@octogonz octogonz Jun 11, 2025

Choose a reason for hiding this comment

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

@gavinxgu Seems like '80' also startsWith('8'). Should we check for something like 8.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should lockfileVersion also be changed from '6' to '6.'? However, I noticed that in the type definitions for lockfile v6, lockfileVersion is defined as string | number. In some cases, if it returns the number 6 and we apply toString(), wouldn't that cause '6.' to fail to match?

Copy link
Member

Choose a reason for hiding this comment

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

You could parse it into a number and then do a numeric comparison for that one. I doubt that lockfileVersion will use X.Y.Z syntax -- it is probably just an integer (or maybe regular decimal).

@zkochan

Copy link

Choose a reason for hiding this comment

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

lockfileVersion is semver consisting of major and minor. It is the version of pnpm that first shipped the new format. The current format is 9.0, which was shippped in pnpm v9.0.0.

- Add pnpm v10 compatibility
- Add multi-version pnpm testing to ensure cross-version compatibility
}
}

export const isPnpmV8 = (pnpmVersion: string): boolean => pnpmVersion.startsWith('8.');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@octogonz I extracted the logic for checking pnpm version into three utility functions.

*/
packages: Record<string, ILockfilePackage>;
}
export type ILockfile = LockfileObjectV6 | LockfileObjectV9;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@octogonz Because we changed to use the official lockfile type provided by pnpm, this change might be a breaking change to the return value type of the readPnpmLockfile function. P.S. However, I'm not quite sure why we previously defined our own pnpmlock file type instead of using the official one.

@octogonz octogonz merged commit 7a14a95 into tiktok:main Jun 13, 2025
2 checks passed
iclanton added a commit to microsoft/rushstack that referenced this pull request Dec 23, 2025
…5254)

* [rush] Upgrade `pnpm-sync-lib` to v0.3.3 for pnpm v10 compatibility

tiktok/pnpm-sync#40
tiktok/pnpm-sync#43

* Fix merge conflicts so "rush-lib" compiles again

* Revert Lockfile Explorer changes, since PNPM 10 support was already implemented after this PR was started

* Dynamic import `@rushstack/rush-pnpm-kit-*` packages.

* Include explicit types.

* Include missing eslint config, README, and LICENSE files.

* Fix lint issues.

* fixup! Dynamic import `@rushstack/rush-pnpm-kit-*` packages.

* Dynamically import the pnpm kits in PnpmShrinkwrapFile.

* Revert "Dynamically import the pnpm kits in PnpmShrinkwrapFile."

This reverts commit 6ede3d3.

* Lazy-load the pnpm kits in PnpmShrinkwrapFile.

* Leave a note about reworking load of @rushstack/rush-pnpm-kit-*.

---------

Co-authored-by: Pete Gonzalez <4673363+octogonz@users.noreply.github.com>
Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
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