Skip to content

Commit

Permalink
fix: use real path for module root dir (#6524) (#7491)
Browse files Browse the repository at this point in the history
close #6524
  • Loading branch information
grimly authored and zkochan committed Jan 8, 2024
1 parent 5a5e425 commit d9564e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/real-knives-bathe.md
@@ -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).

4 changes: 3 additions & 1 deletion config/config/src/index.ts
Expand Up @@ -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
Expand Down

0 comments on commit d9564e3

Please sign in to comment.