这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ First, your package manager needs to describe the locations of your packages. We
}
```

<LinkToDocumentation href="https://bun.sh/docs/install/workspaces">npm workspace documentation</LinkToDocumentation>
<LinkToDocumentation href="https://bun.sh/docs/install/workspaces">bun workspace documentation</LinkToDocumentation>
</Tab>

</PackageManagerTabs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ title: Add to an existing repository
description: Using Turborepo with your existing repository
---

import { Tabs, Tab } from '#components/tabs';
import { PackageManagerTabs, Tabs, Tab } from '#components/tabs';
import { Callout } from '#components/callout';
import { Step, Steps } from '#components/steps';
import { LinkToDocumentation } from '#components/link-to-documentation';

Turborepo can be incrementally adopted in **any repository, single or multi-package**, to speed up the developer and CI workflows of the repository.

Expand Down Expand Up @@ -197,6 +198,74 @@ Turborepo optimizes your repository using information from your package manager.
yet.
</Callout>

</Step>
<Step>
### Set up package manager workspaces

For [multi-package workspaces](https://vercel.com/docs/glossary#multi-package-workspace), you'll need to configure your package manager to recognize your workspace structure.

The `workspaces` field tells your package manager which directories contain your packages. Common patterns include `apps/*` for applications and `packages/*` for shared libraries.

<Callout type="good-to-know">
If you're working with a single-package repository, you can skip this step as
workspaces aren't needed.
</Callout>

<PackageManagerTabs>

<Tab value="pnpm">
```json title="pnpm-workspace.yaml"
packages:
- "apps/*"
- "packages/*"
```
<LinkToDocumentation href="https://pnpm.io/pnpm-workspace_yaml">pnpm workspace documentation</LinkToDocumentation>

</Tab>

<Tab value="yarn">
```json title="./package.json"
{
"workspaces": [
"apps/*",
"packages/*"
]
}
```

<LinkToDocumentation href="https://yarnpkg.com/features/workspaces#how-are-workspaces-declared">yarn workspace documentation</LinkToDocumentation>
</Tab>

<Tab value="npm">
```json title="./package.json"
{
"workspaces": [
"apps/*",
"packages/*"
]
}
```

<LinkToDocumentation href="https://docs.npmjs.com/cli/v7/using-npm/workspaces#defining-workspaces">npm workspace documentation</LinkToDocumentation>
</Tab>

<Tab value="bun (Beta)">
```json title="./package.json"
{
"workspaces": [
"apps/*",
"packages/*"
]
}
```

<LinkToDocumentation href="https://bun.sh/docs/install/workspaces">bun workspace documentation</LinkToDocumentation>
</Tab>

</PackageManagerTabs>

For more details on how to structure your repository, see [Structuring a Repository](/docs/crafting-your-repository/structuring-a-repository#declaring-directories-for-packages).

</Step>
<Step>
### Run tasks with `turbo`
Expand Down
Loading