这是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
32 changes: 14 additions & 18 deletions docs/pages/docs/features/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ By default, [`turbo run`](../reference/command-line-reference#turbo-run-task1-ta

Using [`pipeline`](../reference/configuration#pipeline), you can configure cache conventions across your Turborepo.

To override the default cache folder behavior, pass an array of globs to a [`pipeline.<task>.outputs`](../reference/configuration#outputs) array. Any file that satisfies the glob patterns for a task will be treated as artifact.
To override the default cache output behavior, pass an array of globs to a [`pipeline.<task>.outputs`](../reference/configuration#outputs) array. Any file that satisfies the glob patterns for a task will be treated as artifact.

```json
{
"turbo": {
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**"],
"dependsOn": ["^build"]
},
"test": {
"outputs": [], // leave empty to only cache logs
"dependsOn": ["build"]
}
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**"],
"dependsOn": ["^build"]
},
"test": {
"outputs": [], // leave empty to only cache logs
"dependsOn": ["build"]
}
}
}
Expand Down Expand Up @@ -65,11 +63,9 @@ You can also always disable caching on a specific task by setting `cache` to `fa

```json
{
"turbo": {
"pipeline": {
"dev": {
"cache": false
}
"pipeline": {
"dev": {
"cache": false
}
}
}
Expand All @@ -88,7 +84,7 @@ Luckily, you can control `turbo`'s cache fingerprinting (a.k.a. hashing) behavio

```json
{
"turbo": {

"pipeline": {
"build": {
"dependsOn": {
Expand Down Expand Up @@ -125,7 +121,7 @@ Luckily, you can control `turbo`'s cache fingerprinting (a.k.a. hashing) behavio
"tsconfig.json" // file contents will impact the hashes of all tasks,
".env.*" // glob file contents will impact the hashes of all tasks,
],
}

}
```

Expand Down
93 changes: 43 additions & 50 deletions docs/pages/docs/features/pipelines.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,21 @@ To define your project's task dependency graph, use the [`pipeline`](../referenc

Each key in the [`pipeline`](../reference/configuration#pipeline) object is the name of a task that can be executed by [`turbo run`](../reference/command-line-reference#turbo-run-task1-task2-1). You can specify its dependencies with the [`dependsOn`](../reference/configuration#dependson) key beneath it as well as some other options related to [caching](./caching).

An example Pipeline configuration:
An example Pipeline configuration in `turbo.json`:

```json
{
"turbo": {
"pipeline": {
"build": {
"dependsOn": ["^build"]
},
"test": {
"dependsOn": ["build"]
},
"deploy": {
"dependsOn": ["build", "test", "lint"]
},
"lint": {}
}
"pipeline": {
"build": {
"dependsOn": ["^build"]
},
"test": {
"dependsOn": ["build"]
},
"deploy": {
"dependsOn": ["build", "test", "lint"]
},
"lint": {}
}
}
```
Expand All @@ -68,30 +66,28 @@ What you are declaring here in the `pipeline` object of the `turbo` configuratio

```json
{
"turbo": {
"pipeline": {
"build": {
// A package's `build` task depends on that package's
// topological dependencies' and devDependencies'
// `build` tasks being completed
// (that's what the `^` symbol signifies).
"dependsOn": ["^build"]
},
"test": {
// A package's `test` task depends on the `build`
// task of the same package being completed.
"dependsOn": ["build"]
},
"deploy": {
// A package's `deploy` task depends on the `build`,
// `test`, and `lint` tasks of the same package
// being completed.
"dependsOn": ["build", "test", "lint"]
},
// A package's `lint` task has no dependencies and
// can be run whenever.
"lint": {}
}
"pipeline": {
"build": {
// A package's `build` task depends on that package's
// topological dependencies' and devDependencies'
// `build` tasks being completed
// (that's what the `^` symbol signifies).
"dependsOn": ["^build"]
},
"test": {
// A package's `test` task depends on the `build`
// task of the same package being completed.
"dependsOn": ["build"]
},
"deploy": {
// A package's `deploy` task depends on the `build`,
// `test`, and `lint` tasks of the same package
// being completed.
"dependsOn": ["build", "test", "lint"]
},
// A package's `lint` task has no dependencies and
// can be run whenever.
"lint": {}
}
}
```
Expand All @@ -104,15 +100,13 @@ A common pattern in many TypeScript monorepos is to declare that a package's `bu

```json
{
"turbo": {
"pipeline": {
"build": {
// "A package's `build` command depends on its dependencies'
// and devDependencies' `build` commands being completed first"
"dependsOn": ["^build"]
}
// ... omitted for brevity
"pipeline": {
"build": {
// "A package's `build` command depends on its dependencies'
// and devDependencies' `build` commands being completed first"
"dependsOn": ["^build"]
}
// ... omitted for brevity
}
}
```
Expand All @@ -123,8 +117,7 @@ An empty dependency list (`dependsOn` is either undefined or `[]`) means that a

```json
{
"turbo": {
"pipeline": {
"pipeline": {
// ... omitted for brevity

// A package's `lint` command has no dependencies and can be run at
Expand Down Expand Up @@ -152,7 +145,7 @@ For these cases, you can express these relationships in your `pipeline` configur

```json
{
"turbo": {

"pipeline": {
"build": {
"dependsOn": ["^build"]
Expand All @@ -167,7 +160,7 @@ For these cases, you can express these relationships in your `pipeline` configur
"dependsOn": ["ui#test", "backend#deploy", "backend#health-check"]
}
}
}

}
```

Expand Down
1 change: 1 addition & 0 deletions docs/pages/docs/features/scopes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ turbo run build --scope=*build-tools* --no-deps --include-dependencies
Turborepo's Scoped Tasks API design and docs were/are inspired [Microsoft's Lage project](https://microsoft.github.io/lage/guide/scopes.html#scoped-builds-with-all-its-dependents) `--scope` flag which was inspired by [Lerna's](https://github.com/lerna/lerna/tree/main/commands/run#readme).

We are working toward a new, more expressive task filtering/scoping syntax. [Read the RFC here.](https://github.com/vercel/turborepo/discussions/105)

</Callout>
33 changes: 19 additions & 14 deletions docs/pages/docs/guides/migrate-from-lerna.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,25 @@ Alter `package.json` to use `turbo` for task running, but keep `lerna` for versi
"devDependencies": {
"lerna": "^3.19.0",
+ "turbo": "*"
},
+ "turbo": {
+ "pipeline": {
+ "build": {
+ "dependsOn": ["^build"],
+ "outputs": ["dist/**"]
+ },
+ "test": {
+ "outputs": []
+ },
+ "dev": {
+ "cache": false
+ }
+ }
}
}
```

Create a `turbo.json` file in the root of your project.

```json
{
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"test": {
"outputs": []
},
"dev": {
"cache": false
}
}
}
```
Expand Down
41 changes: 18 additions & 23 deletions docs/pages/docs/reference/command-line-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,10 @@ turbo run build test lint --graph=my-graph.png
turbo run build test lint --graph=my-graph.html
```

<Callout>
<Callout type="info">
**Known Bug**: All possible pipeline task nodes will be added to the
graph at the moment, even if that pipeline task does not actually exist in a
given package. This has no impact on execution, it means that:

- the terminal output may overstate the number of packages in which a task is running.
- your dot viz graph may contain additional nodes that represents tasks that do not exist.
given package. This has no impact on execution, it means that 1) the terminal output may overstate the number of packages in which a task is running and 2) your dot viz graph may contain additional nodes that represents tasks that do not exist.
</Callout>

#### `--force`
Expand Down Expand Up @@ -171,22 +168,20 @@ turbo run dev --parallel --no-cache

Default false. Restricts execution to only include specified tasks. This is very similar to how how `lerna` or `pnpm` run tasks by default.

Given this pipeline:
Given this pipeline in `turbo.json`:

```json
{
"turbo": {
"pipeline": {
"build": {
"dependsOn": [
"^build"
]
},
"test": {
"dependsOn": [
"^build"
]
}
"pipeline": {
"build": {
"dependsOn": [
"^build"
]
},
"test": {
"dependsOn": [
"^build"
]
}
}
}
Expand All @@ -211,7 +206,7 @@ turbo run dev --parallel --no-cache

`type: string[]`

Specify/filter package(s)/apps to act as entry points for execution. Globs against package.json `name` field (and not the file system.)
Specify/filter package(s)/apps to act as entry points for execution. Globs against `package.json` `name` field (and not the file system.)

```sh
turbo run lint --scope="@example/**"
Expand All @@ -236,7 +231,7 @@ Filter execution based on which packages have changed since a merge-base.
turbo run build --since=origin/main
```

<Callout emoji="🚨">
<Callout type="info">
**Important**: This uses the `git diff ${target_branch}...` mechanism to
identify which packages have changed. There is an assumption that all the
input files for a package exist inside their respective package/app folders.
Expand Down Expand Up @@ -271,7 +266,7 @@ You can also set the value of the current team by setting an environment variabl

To view CPU trace, outputs the trace to the given file, use `go tool trace [file]`.

<Callout emoji="🚨">
<Callout>
**Important**: The trace viewer doesn't work under Windows Subsystem for Linux.
</Callout>

Expand All @@ -295,9 +290,9 @@ turbo run build --heap="<heap-file-name>"

To view CPU profile, outputs the profile to the given file, drop the file into [speedscope](https://speedscope.app).

<Callout emoji="🚨">
<Callout>
**Important**: The CPU profiler doesn't work under
Windows subsystem for Linux. The profiler has to be built
Windows Subsystem for Linux. The profiler has to be built
for native Windows and run using the command prompt instead.
</Callout>

Expand Down