mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-30 10:38:13 -05:00
refactor: always load all projects into allProjectsGraph (#9259)
This commit is contained in:
8
.changeset/fresh-buttons-travel.md
Normal file
8
.changeset/fresh-buttons-travel.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": minor
|
||||
pnpm: minor
|
||||
---
|
||||
|
||||
Removed a branching code path that only executed when `dedupe-peer-dependents=false`. We believe this internal refactor will not result in behavior changes, but we expect it to make future pnpm versions behave more consistently for projects that override `dedupe-peer-dependents` to false. There should be less unique bugs from turning off `dedupe-peer-dependents`.
|
||||
|
||||
See details in [#9259](https://github.com/pnpm/pnpm/pull/9259).
|
||||
@@ -220,31 +220,10 @@ when running add/update with the --workspace option')
|
||||
})
|
||||
}
|
||||
|
||||
const didUserConfigureCatalogs = Object.values(opts.catalogs ?? {})
|
||||
.some(catalog => Object.keys(catalog ?? {}).length > 0)
|
||||
const allProjectsGraph: ProjectsGraph = opts.allProjectsGraph ?? createPkgGraph(allProjects, {
|
||||
linkWorkspacePackages: Boolean(opts.linkWorkspacePackages),
|
||||
}).graph
|
||||
|
||||
// pnpm catalogs and dedupe-peer-dependents are features that require the
|
||||
// allProjectsGraph to contain all projects to correctly update the wanted
|
||||
// lockfile. Otherwise the wanted lockfile would be partially updated for
|
||||
// only the selected projects specified for the filtered install.
|
||||
//
|
||||
// This should still be performance since only dependencies for the
|
||||
// selectedProjectsGraph are installed. The allProjectsGraph is only used
|
||||
// to compute the wanted lockfile.
|
||||
let allProjectsGraph!: ProjectsGraph
|
||||
if (didUserConfigureCatalogs || opts.dedupePeerDependents) {
|
||||
allProjectsGraph = opts.allProjectsGraph ?? createPkgGraph(allProjects, {
|
||||
linkWorkspacePackages: Boolean(opts.linkWorkspacePackages),
|
||||
}).graph
|
||||
} else {
|
||||
allProjectsGraph = selectedProjectsGraph
|
||||
if (!allProjectsGraph[opts.workspaceDir as ProjectRootDir]) {
|
||||
allProjectsGraph = {
|
||||
...allProjectsGraph,
|
||||
...selectProjectByDir(allProjects, opts.workspaceDir),
|
||||
}
|
||||
}
|
||||
}
|
||||
await recursiveInstallThenUpdateWorkspaceState(allProjects,
|
||||
params,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user