From 227c903e6a97841d4c1d7c85baf1bc9feab957d6 Mon Sep 17 00:00:00 2001 From: Michel TURPIN Date: Thu, 4 Jan 2024 16:13:36 +0100 Subject: [PATCH] fix: use real path for module root dir (#6524) --- .changeset/real-knives-bathe.md | 5 +++++ pkg-manager/plugin-commands-installation/src/recursive.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/real-knives-bathe.md diff --git a/.changeset/real-knives-bathe.md b/.changeset/real-knives-bathe.md new file mode 100644 index 00000000000..9f9642f418b --- /dev/null +++ b/.changeset/real-knives-bathe.md @@ -0,0 +1,5 @@ +--- +"@pnpm/plugin-commands-installation": patch +--- + +Fetches the local module real path diff --git a/pkg-manager/plugin-commands-installation/src/recursive.ts b/pkg-manager/plugin-commands-installation/src/recursive.ts index bf77d8eb18f..6f5790627ab 100755 --- a/pkg-manager/plugin-commands-installation/src/recursive.ts +++ b/pkg-manager/plugin-commands-installation/src/recursive.ts @@ -170,6 +170,7 @@ export async function recursive ( const calculatedRepositoryRoot = await fs.realpath(calculateRepositoryRoot(opts.workspaceDir, importers.map(x => x.rootDir))) const isFromWorkspace = isSubdir.bind(null, calculatedRepositoryRoot) importers = await pFilter(importers, async ({ rootDir }: { rootDir: string }) => isFromWorkspace(await fs.realpath(rootDir))) + importers = await Promise.all(importers.map(async ({ rootDir, ...rest }) => ({ rootDir: await fs.realpath(rootDir), ...rest }))) if (importers.length === 0) return true let mutation!: string switch (cmdFullName) {