diff --git a/.changeset/fresh-buttons-travel.md b/.changeset/fresh-buttons-travel.md new file mode 100644 index 0000000000..a4091df2b3 --- /dev/null +++ b/.changeset/fresh-buttons-travel.md @@ -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). diff --git a/pkg-manager/plugin-commands-installation/src/installDeps.ts b/pkg-manager/plugin-commands-installation/src/installDeps.ts index ad2e120b21..70e676bb1b 100644 --- a/pkg-manager/plugin-commands-installation/src/installDeps.ts +++ b/pkg-manager/plugin-commands-installation/src/installDeps.ts @@ -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, {