Skip to content

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
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