Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Fix poor performance scaling during `rush install` when identifying projects in the lockfile that no longer exist.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
12 changes: 8 additions & 4 deletions libraries/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import type {
ResolvedDependencies
} from '@pnpm/lockfile.types';
import { convertLockfileV9ToLockfileObject } from './PnpmShrinkWrapFileConverters';
import type { IReadonlyLookupByPath } from '@rushstack/lookup-by-path';

const yamlModule: typeof import('js-yaml') = Import.lazy('js-yaml', require);

Expand Down Expand Up @@ -812,12 +813,15 @@ export class PnpmShrinkwrapFile extends BaseShrinkwrapFile {
return super.findOrphanedProjects(rushConfiguration, subspace);
}

const subspaceTempFolder: string = subspace.getSubspaceTempFolderPath();
const lookup: IReadonlyLookupByPath<RushConfigurationProject> =
rushConfiguration.getProjectLookupForRoot(subspaceTempFolder);

const orphanedProjectPaths: string[] = [];
for (const importerKey of this.getImporterKeys()) {
// PNPM importer keys are relative paths from the workspace root, which is the common temp folder
const rushProjectPath: string = path.resolve(subspace.getSubspaceTempFolderPath(), importerKey);
if (!rushConfiguration.tryGetProjectForPath(rushProjectPath)) {
orphanedProjectPaths.push(rushProjectPath);
if (!lookup.findChildPath(importerKey)) {
// PNPM importer keys are relative paths from the workspace root, which is the common temp folder
orphanedProjectPaths.push(path.resolve(subspaceTempFolder, importerKey));
}
}
return orphanedProjectPaths;
Expand Down
Loading