-
-
Notifications
You must be signed in to change notification settings - Fork 937
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: downgrade npm-packlist to improve performance
- Loading branch information
Showing
7 changed files
with
176 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@pnpm/fs.packlist": patch | ||
"pnpm": patch | ||
--- | ||
|
||
Downgraded `npm-packlist` because the newer version significantly slows down the installation of local directory dependencies, making it unbearably slow. | ||
|
||
`npm-packlist` was upgraded in [this PR](https://github.com/pnpm/pnpm/pull/7250) to fix [#6997](https://github.com/pnpm/pnpm/issues/6997). We added our own file deduplication to fix the issue of duplicate file entries. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import Arborist from '@npmcli/arborist' | ||
import npmPacklist from 'npm-packlist' | ||
|
||
export async function packlist (pkgDir: string) { | ||
const arborist = new Arborist(({ path: pkgDir })) | ||
const tree = await arborist.loadActual() | ||
return npmPacklist(tree) | ||
export async function packlist (pkgDir: string): Promise<string[]> { | ||
const files = await npmPacklist({ path: pkgDir }) | ||
// There's a bug in the npm-packlist version that we use, | ||
// it sometimes returns duplicates. | ||
// Related issue: https://github.com/pnpm/pnpm/issues/6997 | ||
// Unfortunately, we cannot upgrade the library | ||
// newer versions of npm-packlist are very slow. | ||
return Array.from(new Set(files.map((file) => file.replace(/^\.[/\\]/, '')))) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.