Skip to content

Commit

Permalink
Support pnpm v9
Browse files Browse the repository at this point in the history
  • Loading branch information
fzxen committed Nov 26, 2024
1 parent a9b6c47 commit 21a7a65
Show file tree
Hide file tree
Showing 25 changed files with 1,173 additions and 146 deletions.
2 changes: 1 addition & 1 deletion apps/lockfile-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"js-yaml": "~3.13.1",
"open": "~8.4.0",
"update-notifier": "~5.1.0",
"@pnpm/dependency-path": "~2.1.2",
"@pnpm/dependency-path-lockfile-pre-v9": "npm:@pnpm/dependency-path@~2.1.2",
"semver": "~7.5.4",
"@rushstack/rush-sdk": "workspace:*",
"@rushstack/ts-command-line": "workspace:*"
Expand Down
6 changes: 3 additions & 3 deletions apps/lockfile-explorer/src/utils/shrinkwrap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

import * as dp from '@pnpm/dependency-path';
import * as dependencyPathLockfilePreV9 from '@pnpm/dependency-path-lockfile-pre-v9';

interface IPackageInfo {
name: string;
Expand All @@ -12,7 +12,7 @@ interface IPackageInfo {
export function convertLockfileV6DepPathToV5DepPath(newDepPath: string): string {
if (!newDepPath.includes('@', 2) || newDepPath.startsWith('file:')) return newDepPath;
const index = newDepPath.indexOf('@', newDepPath.indexOf('/@') + 2);
if (newDepPath.includes('(') && index > dp.indexOfPeersSuffix(newDepPath)) return newDepPath;
if (newDepPath.includes('(') && index > dependencyPathLockfilePreV9.indexOfPeersSuffix(newDepPath)) return newDepPath;
return `${newDepPath.substring(0, index)}/${newDepPath.substring(index + 1)}`;
}

Expand All @@ -21,7 +21,7 @@ export function parseDependencyPath(shrinkwrapFileMajorVersion: number, newDepPa
if (shrinkwrapFileMajorVersion === 6) {
dependencyPath = convertLockfileV6DepPathToV5DepPath(newDepPath);
}
const packageInfo = dp.parse(dependencyPath);
const packageInfo = dependencyPathLockfilePreV9.parse(dependencyPath);
return {
name: packageInfo.name as string,
peersSuffix: packageInfo.peersSuffix,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Support pnpm lockfile v9, which is used by default starting in pnpm v9.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/lockfile-explorer",
"comment": "",
"type": ""
}
],
"packageName": "@rushstack/lockfile-explorer"
}
4 changes: 4 additions & 0 deletions common/config/rush/nonbrowser-approved-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
"name": "@pnpm/logger",
"allowedCategories": [ "libraries" ]
},
{
"name": "@pnpm/lockfile.types",
"allowedCategories": [ "libraries" ]
},
{
"name": "@redis/client",
"allowedCategories": [ "libraries" ]
Expand Down
68 changes: 53 additions & 15 deletions common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions common/config/subspaces/build-tests-subspace/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "0f47782f3b6360aa0f60fe19db3d1a0b4ce4f50b",
"pnpmShrinkwrapHash": "77dc2b5589007427c922dc7e49a2617ab00b1075",
"preferredVersionsHash": "ce857ea0536b894ec8f346aaea08cfd85a5af648",
"packageJsonInjectedDependenciesHash": "005dd07c7693259c12de49ac20abda7c14ee0c26"
"packageJsonInjectedDependenciesHash": "8271db192b58e2d0b5f0645a9d04594c81b91410"
}
56 changes: 51 additions & 5 deletions common/config/subspaces/default/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/subspaces/default/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "42f4667a7609b88a8a9a9b87c73c9c806a2071b9",
"pnpmShrinkwrapHash": "c7b3cd82826da4f30f8a13538d7c3eb501949160",
"preferredVersionsHash": "ce857ea0536b894ec8f346aaea08cfd85a5af648"
}
Loading

0 comments on commit 21a7a65

Please sign in to comment.