mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
perf(package-store): don't create dep dir twice
This commit is contained in:
5
.changeset/great-mayflies-call.md
Normal file
5
.changeset/great-mayflies-call.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/package-store": minor
|
||||
---
|
||||
|
||||
Don't try to create the dependency directory twice.
|
||||
@@ -44,14 +44,14 @@ async function tryImportIndexedDir (importFile: ImportFile, newDir: string, file
|
||||
const alldirs = new Set<string>()
|
||||
Object.keys(filenames)
|
||||
.forEach((f) => {
|
||||
const dir = path.join(newDir, path.dirname(f))
|
||||
const dir = path.dirname(f)
|
||||
if (dir === '.') return
|
||||
alldirs.add(dir)
|
||||
})
|
||||
await Promise.all(
|
||||
Array.from(alldirs)
|
||||
.sort((d1, d2) => d1.length - d2.length)
|
||||
.map((dir) => fs.mkdir(dir, { recursive: true }))
|
||||
.sort((d1, d2) => d1.length - d2.length) // from shortest to longest
|
||||
.map((dir) => fs.mkdir(path.join(newDir, dir), { recursive: true }))
|
||||
)
|
||||
await Promise.all(
|
||||
Object.entries(filenames)
|
||||
|
||||
Reference in New Issue
Block a user