Skip to content

[rush] exemptPackageVersions in pnpm-config.json file does not work with pnpm 9 #5524

@LPegasus

Description

@LPegasus

Summary

During the process of upgrading the project from [email protected] to [email protected], an error occurred as shown in the following image when executing rush update --recheck.

Image

Repro steps

Find a package in pnpm-lock.yaml with sha1 integrity. Use [email protected] and run rush update --recheck.

Expected result: Update the lockfile successfully.

Actual result: Failed.

Details

I think the problem is here:

/**
* Normalize dependency paths for PNPM shrinkwrap files.
* Example: "/[email protected]([email protected])" --> "/[email protected]"
* Example: "/@typescript-eslint/experimental-utils/[email protected][email protected]" --> "/@typescript-eslint/experimental-utils/5.9.1"
*/
private _parseDependencyPath(packagePath: string): string {
let depPath: string = packagePath;
if (this.shrinkwrapFileMajorVersion >= ShrinkwrapFileMajorVersion.V6) {
depPath = this._convertLockfileV6DepPathToV5DepPath(packagePath);
}
const pkgInfo: ReturnType<typeof pnpmKitV8.dependencyPath.parse> =
pnpmKitV8.dependencyPath.parse(depPath);
return this._getPackageId(pkgInfo.name as string, pkgInfo.version as string);
}

I think the code above need to handle the lockfile version v9 scenario.

Tried to fix this issue in #5525

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.164.0
rushVersion from rush.json? 5.164.0
pnpmVersion, npmVersion, or yarnVersion from rush.json? [email protected]
(if pnpm) useWorkspaces from pnpm-config.json? Yes
Operating system? Mac
Would you consider contributing a PR? Yes
Node.js version (node -v)? 22.20.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions