Skip to content

Commit

Permalink
docs (link): explain difference of arguments (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoaldamav committed Sep 6, 2023
1 parent 40e5ff2 commit 65cf86f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/cli/link.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,28 @@ Links package from location where this command was executed or specified via `--

Links the specified package (`<pkg>`) from global `node_modules` to the `node_modules` of package from where this command was executed or specified via `--dir` option.

## Difference between `pnpm link <dir>` and `pnpm link --dir <dir>`

`pnpm link <dir>` links the package from `<dir>` to the `node_modules` of the package where the command was executed. `pnpm link --dir <dir>` links the package from the current working directory to `<dir>`.

```bash
# The current directory is foo
pnpm link ../bar

- foo
- node_modules
- bar -> ../../bar
- bar

# The current directory is bar
pnpm link --dir ../foo

- foo
- node_modules
- bar -> ../../bar
- bar
```

## Use Cases

### Replace an installed package with a local version of it
Expand Down

0 comments on commit 65cf86f

Please sign in to comment.