Skip to content

Commit

Permalink
update workspaces.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway committed Jan 6, 2025
1 parent e1cfea4 commit 5e9e188
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/install/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ Each workspace has it's own `package.json`. When referencing other packages in t
}
```

`bun install` will install dependencies for all workspaces in the monorepo, de-duplicating packages if possible. If you only want to install dependencies for specific workspaces, you can use the `--filter` flag.

```bash
# Install dependencies for all workspaces starting with `pkg-` except for `pkg-c`
$ bun install --filter "pkg-*" --filter "!pkg-c"

# Paths can also be used. This is equivalent to the command above.
$ bun install --filter "./packages/pkg-*" --filter "!pkg-c" # or --filter "!./packages/pkg-c"
```

Workspaces have a couple major benefits.

- **Code can be split into logical parts.** If one package relies on another, you can simply add it as a dependency in `package.json`. If package `b` depends on `a`, `bun install` will install your local `packages/a` directory into `node_modules` instead of downloading it from the npm registry.
Expand Down

0 comments on commit 5e9e188

Please sign in to comment.