fix: use real path for module root dir (#6524) (#7491)

close #6524
This commit is contained in:
Michel TURPIN authored and Zoltan Kochan committed 2024-01-09 00:59:19 +01:00
1 parent 5a5e42551e
commit d9564e3546
2 files changed
+10 -1

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
---
"@pnpm/config": patch
"pnpm": patch
---
Resolve the current working directory to its real location before doing any operations [#6524](https://github.com/pnpm/pnpm/issues/6524).
+3 -1
View File
@@ -291,7 +291,9 @@ export async function getConfig (
...rcOptions.map((configKey) => [camelcase(configKey), npmConfig.get(configKey)]) as any, // eslint-disable-line
...Object.entries(cliOptions).filter(([name, value]) => typeof value !== 'undefined').map(([name, value]) => [camelcase(name), value]),
]) as unknown as ConfigWithDeprecatedSettings
const cwd = betterPathResolve(cliOptions.dir ?? npmConfig.localPrefix)
// Resolving the current working directory to its actual location is crucial.
// This prevents potential inconsistencies in the future, especially when processing or mapping subdirectories.
const cwd = fs.realpathSync(betterPathResolve(cliOptions.dir ?? npmConfig.localPrefix))
pnpmConfig.maxSockets = npmConfig.maxsockets
// @ts-expect-error