Skip to content

Commit

Permalink
fix: dir path repeated join in link global (#5434)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvqq committed Oct 1, 2022
1 parent 2e830c0 commit 5beb4e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rotten-moose-search.md
@@ -0,0 +1,5 @@
---
"@pnpm/plugin-commands-installation": patch
---

fix dir path repeated join in link global
2 changes: 1 addition & 1 deletion packages/plugin-commands-installation/src/link.ts
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-commands-installation/test/link.ts
Expand Up @@ -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,
Expand Down

0 comments on commit 5beb4e2

Please sign in to comment.