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

close #6524
This commit is contained in:
Michel TURPIN
2024-01-09 00:52:06 +01:00
committed by Zoltan Kochan
parent 5a5e42551e
commit d9564e3546
2 changed files with 10 additions and 1 deletions

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).

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