这是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
10 changes: 5 additions & 5 deletions docs/site/components/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function Tabs({
);
}

const packageManagers = ["pnpm", "yarn", "npm"];
const packageManagers = ["pnpm", "yarn", "npm", "bun (Beta)"];

const checkPackageManagerIndex = (index: number, provided: string) => {
if (provided !== packageManagers[index]) {
Expand All @@ -43,11 +43,11 @@ export function PackageManagerTabs({
throw new Error("Children must be an array.");
}

children.forEach((packageManager, index) => {
if (!packageManager.props.value) {
throw new Error(`Package manager tab is missing a value.`);
}
if (packageManagers.length > children.length) {
throw new Error(`Package manager tab is missing a value.`);
}

children.forEach((packageManager, index) => {
checkPackageManagerIndex(index, packageManager.props.value);
});

Expand Down
10 changes: 10 additions & 0 deletions docs/site/content/docs/core-concepts/internal-packages.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ Internal Packages are used in your repository by installing them in `package.jso
}
```
</Tab>

<Tab value="bun (Beta)">
```json title="./apps/web/package.json"
{
"dependencies": {
"@repo/ui": "workspace:*" // [!code highlight]
}
}
```
</Tab>
</PackageManagerTabs>

In the [Creating an Internal Package guide](/docs/crafting-your-repository/creating-an-internal-package), you can build an Internal Package from the beginning using [the Compiled Package strategy](#compiled-packages). On this page, we'll describe other strategies for creating Internal Packages and their tradeoffs, including [publishing the package to the npm registry](#publishable-packages) to create an External Package.
Expand Down
8 changes: 8 additions & 0 deletions docs/site/content/docs/core-concepts/remote-caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ yarn dlx turbo login
npx turbo login
```

</Tab>

<Tab value="bun (Beta)">

```bash title="Terminal"
bunx turbo login
```

</Tab>
</PackageManagerTabs>

Expand Down
8 changes: 8 additions & 0 deletions docs/site/content/docs/crafting-your-repository/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ yarn build
npm run build
```

</Tab>

<Tab value="bun (Beta)">

```bash title="Terminal"
bun run build
```

</Tab>
</PackageManagerTabs>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,35 @@ Next, create the `package.json` for the package. By adding this file, you'll ful
"typescript": "latest"
}
}
````
```

</Tab>

<Tab value="bun (Beta)">
```json title="./packages/math/package.json"
{
"name": "@repo/math",
"type": "module",
"scripts": {
"dev": "tsc --watch",
"build": "tsc"
},
"exports": {
"./add": {
"types": "./src/add.ts",
"default": "./dist/add.js"
},
"./subtract": {
"types": "./src/subtract.ts",
"default": "./dist/subtract.js"
}
},
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"typescript": "latest"
}
}
```

</Tab>
</PackageManagerTabs>
Expand Down Expand Up @@ -237,6 +265,17 @@ You're ready to use your new package in an application. Let's add it to the `web
},
```
</Tab>

<Tab value="bun (Beta)">
```diff title="apps/web/package.json"
"dependencies": {
+ "@repo/math": "workspace:*",
"next": "latest",
"react": "latest",
"react-dom": "latest"
},
```
</Tab>
</PackageManagerTabs>

<Callout type="warn">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ import { LinkToDocumentation } from '#/components/link-to-documentation';
}
```
</Tab>

<Tab value="bun (Beta)">
```json title="./apps/web/package.json"
{
"dependencies": {
"next": "latest", // External dependency
"@repo/ui": "workspace:*" // Internal dependency
}
}
```
</Tab>
</PackageManagerTabs>

## Best practices for dependency installation
Expand Down Expand Up @@ -101,6 +112,15 @@ npm install jest --workspace=web --workspace=@repo/ui --save-dev

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

<Tab value="bun (Beta)">

```bash title="Terminal"
bun install jest --filter=web --filter=@repo/ui --dev
```

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

This practice has several benefits:
Expand Down Expand Up @@ -190,6 +210,13 @@ npm install typescript@latest --workspaces
```
<small>[→ npm documentation](https://docs.npmjs.com/cli/v7/using-npm/config#workspaces)</small>

</Tab>

<Tab value="bun (Beta)">
No equivalent

<small>[→ Bun documentation](https://bun.sh/docs/install/workspaces)</small>

</Tab>
</PackageManagerTabs>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ yarn dev

```bash title="Terminal"
npm run dev
```

</Tab>

<Tab value="bun (Beta)">

```bash title="Terminal"
bun run dev
```

</Tab>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ npx create-turbo@latest

</Tab>

<Tab value="bun (Beta)">
```bash title="Terminal"
bunx create-turbo@latest
```

</Tab>

</PackageManagerTabs>

You can then review the repository for the characteristics described in this guide.
Expand All @@ -61,6 +68,7 @@ Below, the structural elements of `create-turbo` that make it a valid workspace
<Files>
<File name="package.json" green />
<File name="pnpm-lock.yaml" green />
<File name="pnpm-workspace.yaml" green />
<File name="turbo.json" />
<Folder name="apps" defaultOpen>
<Folder name="docs" className="text-foreground" defaultOpen>
Expand Down Expand Up @@ -120,6 +128,27 @@ Below, the structural elements of `create-turbo` that make it a valid workspace
</Files>
</Tab>

<Tab value="bun (Beta)">
<Files>
<File name="package.json" green />
<File name="bun.lock" green />
<File name="turbo.json" />
<Folder name="apps" defaultOpen>
<Folder name="docs" className="text-foreground" defaultOpen>
<File name="package.json" green />
</Folder>
<Folder name="web">
<File name="package.json" green />
</Folder>
</Folder>
<Folder name="packages">
<Folder name="ui">
<File name="package.json" green />
</Folder>
</Folder>
</Files>
</Tab>

</PackageManagerTabs>

### Minimum requirements
Expand Down Expand Up @@ -176,6 +205,20 @@ First, your package manager needs to describe the locations of your packages. We

<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">npm workspace documentation</LinkToDocumentation>
</Tab>

</PackageManagerTabs>

Using this configuration, every directory **with a `package.json`** in the `apps` or `packages` directories will be considered a package.
Expand Down Expand Up @@ -258,6 +301,25 @@ The root `package.json` is the base for your workspace. Below is a common exampl
}
```

</Tab>

<Tab value="bun (Beta)">

```json title="./package.json"
{
"private": true,
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev",
"lint": "turbo run lint"
},
"devDependencies": {
"turbo": "latest"
},
"packageManager": "bun@1.2.0"
}
```

</Tab>
</PackageManagerTabs>

Expand Down
18 changes: 18 additions & 0 deletions docs/site/content/docs/crafting-your-repository/upgrading.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ npx @turbo/codemod migrate

</Tab>

<Tab value="bun (Beta)">

```bash title="Terminal"
bunx @turbo/codemod migrate
```

</Tab>

</PackageManagerTabs>

This will update your `turbo.json`(s) for many of the breaking changes from 1.x to 2.0.
Expand Down Expand Up @@ -93,6 +101,16 @@ Turborepo 2.0 requires that your Workspace define this field as a way to improve
}
```

</Tab>

<Tab value="bun (Beta)">

```diff title="./package.json"
{
+ "packageManager": "bun@1.2.0"
}
```

</Tab>
</PackageManagerTabs>

Expand Down
12 changes: 12 additions & 0 deletions docs/site/content/docs/getting-started/examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ npx create-turbo@latest --example [github-url]

</Tab>

<Tab value="bun (Beta)">

```bash title="Terminal"
# Use an example listed below
bunx create-turbo@latest --example [example-name]

# Use a GitHub repository from the community
bunx create-turbo@latest --example [github-url]
```

</Tab>

</PackageManagerTabs>

## Core-maintained examples
Expand Down
21 changes: 21 additions & 0 deletions docs/site/content/docs/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ npx create-turbo@latest

</Tab>

<Tab value="bun (Beta)">
```bash title="Terminal"
bunx create-turbo@latest
```

</Tab>

</PackageManagerTabs>

The starter repository will have:
Expand Down Expand Up @@ -71,6 +78,13 @@ A global install of `turbo` brings flexibility and speed to your local workflows

</Tab>

<Tab value="bun (Beta)">
```bash title="Terminal"
bun install turbo --global
```

</Tab>

</PackageManagerTabs>

Once installed globally, you can run your scripts through `turbo` from your terminal, quickly running one-off commands to use within your repository. For example:
Expand Down Expand Up @@ -123,6 +137,13 @@ When collaborating with other developers in a repository, it's a good idea to pi

</Tab>

<Tab value="bun (Beta)">
```bash title="Terminal"
bun install turbo --dev
```

</Tab>

</PackageManagerTabs>

You can continue to use your global installation of `turbo` to run commands. Global `turbo` will defer to the local version of your repository if it exists.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ lockfile formats.
| pnpm 8+ | Yes |
| npm 8+ | Yes |
| yarn 1+ | Yes (Includes Yarn Plug'n'Play) |
| bun 1+ | Beta |
| bun 1.2+ | Beta |

<Callout type="info">
Package managers have their own release schedules, bugs, and features. While
Expand Down
Loading
Loading