fix: dir path repeated join in link global (#5434)

This commit is contained in:
chlorine
2022-10-01 20:10:48 +08:00
committed by GitHub
parent 2e830c0cb7
commit 5beb4e26b8
3 changed files with 7 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/plugin-commands-installation": patch
---
fix dir path repeated join in link global

View File

@@ -116,7 +116,7 @@ export async function handler (
const { manifest, writeProjectManifest } = await tryReadProjectManifest(opts.dir, opts)
const newManifest = await addDependenciesToPackage(
manifest ?? {},
[`link:${opts.cliOptions?.dir ? path.join(cwd, opts.cliOptions.dir) : cwd}`],
[`link:${opts.cliOptions?.dir ? path.resolve(opts.cliOptions.dir) : cwd}`],
linkOpts
)
await writeProjectManifest(newManifest)

View File

@@ -88,7 +88,7 @@ test('link --dir global bin', async function () {
await link.handler({
...DEFAULT_OPTS,
cliOptions: {
dir: './dir/package-with-bin-in-dir',
dir: path.resolve('./dir/package-with-bin-in-dir'),
},
bin: globalBin,
dir: globalDir,