mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-07 15:38:24 -04:00
perf: don't unnecessarily search for projects
This commit is contained in:
@@ -330,12 +330,13 @@ export async function handler (
|
||||
input = input.filter(Boolean)
|
||||
|
||||
const dir = opts.dir || process.cwd()
|
||||
let allProjects = opts.allProjects
|
||||
let workspacePackages = undefined
|
||||
|
||||
const workspacePackages = opts.workspaceDir
|
||||
? arrayOfWorkspacePackagesToMap(
|
||||
await findWorkspacePackages(opts.workspaceDir, opts),
|
||||
)
|
||||
: undefined
|
||||
if (opts.workspaceDir) {
|
||||
allProjects = allProjects ?? await findWorkspacePackages(opts.workspaceDir, opts)
|
||||
workspacePackages = arrayOfWorkspacePackagesToMap(allProjects)
|
||||
}
|
||||
|
||||
const store = await createOrConnectStoreController(opts)
|
||||
const installOpts = {
|
||||
@@ -404,9 +405,7 @@ export async function handler (
|
||||
}
|
||||
|
||||
if (opts.linkWorkspacePackages && opts.workspaceDir) {
|
||||
// TODO: reuse somehow the previous read of packages
|
||||
// this is not optimal
|
||||
const allProjects = await findWorkspacePackages(opts.workspaceDir, opts)
|
||||
allProjects = allProjects ?? await findWorkspacePackages(opts.workspaceDir, opts)
|
||||
const selectedProjectsGraph = await filterPkgsBySelectorObjects(allProjects, [
|
||||
{
|
||||
excludeSelf: true,
|
||||
|
||||
Reference in New Issue
Block a user