mirror of
https://github.com/pnpm/pnpm.git
synced 2026-07-25 15:07:06 -04:00
* fix: resolve relative path params in global add against CWD When running `pnpm -g add .`, the "." was resolved relative to the temporary install directory instead of the user's working directory. This happened because handleGlobalAdd switches opts.dir to a fresh temp directory before the dependency selectors are resolved. Now relative path params (., ./foo, ../bar, file:./foo, link:../bar) are resolved to absolute paths before the directory is switched. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: resolve relative local selectors against opts.dir instead of process.cwd() This fixes `pnpm -C <dir> -g add .` where the relative selector would incorrectly resolve against process.cwd() instead of the user's intended directory. Also adds test coverage for file: and link: prefixed selectors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(config): stop overwriting dir to globalPkgDir for global commands Previously, `pnpmConfig.dir` was set to `globalPkgDir` when `--global` was used. This caused `opts.dir` to point to the global packages directory instead of the user's CWD, breaking `pnpm -g add .` because relative paths resolved against the wrong directory. Now `pnpmConfig.dir` is always set to the user's CWD. Global command handlers already use `opts.globalPkgDir` where they need the global packages directory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: use globalPkgDir in pnpm root -g handler The root command handler was using opts.dir which no longer points to the global packages directory. Use opts.globalPkgDir instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>