Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(migration): update turborepo migration guide #29522

Merged
merged 1 commit into from
Jan 16, 2025
Merged
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
31 changes: 15 additions & 16 deletions docs/shared/migration/from-turborepo.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See the [Adding Nx to NPM/Yarn/PNPM Workspace](/recipes/adopting-nx/adding-to-mo

## Convert turbo.json into Nx Configuration

Most of the settings in your `turbo.json` file can be converted directly into `nx.json` equivalents. The key configuration properties of `dependsOn`, `inputs` and `outputs` have a very similar syntax and can probably be copied over directly from the `turbo.json` `pipeline` into the `nx.json` `targetDefaults`.
Most of the settings in your `turbo.json` file can be converted directly into `nx.json` equivalents. The key configuration properties of `dependsOn`, `inputs` and `outputs` have a very similar syntax and can probably be copied over directly from the `turbo.json` `tasks` into the `nx.json` `targetDefaults`.

If you have project-specific tasks defined in the root `turbo.json` (i.e. `myreactapp#build`) or in project-level `turbo.json` files (i.e. `/packages/myreactapp/turbo.json`), those settings should go in the `nx` property of the project's `package.json` (i.e. `/packages/myreactapp/package.json`).

Expand All @@ -29,7 +29,7 @@ Let's say you start with the following `turbo.json` file:
```json {% fileName="/turbo.json" %}
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
Expand Down Expand Up @@ -105,20 +105,19 @@ For each `turbo.json` configuration property, the equivalent Nx property is list
| `globalDependencies` | add to the [`sharedGlobals` `namedInput`](/recipes/running-tasks/configure-inputs) |
| `globalEnv` | add to the [`sharedGlobals` `namedInput`](/recipes/running-tasks/configure-inputs) as an [`env` input](/reference/inputs#environment-variables) |
| `globalPassThroughEnv` | N/A. See [Defining Environment Variables](/recipes/tips-n-tricks/define-environment-variables) |
| `globalDotEnv` | add to the [`sharedGlobals` `namedInput`](/recipes/running-tasks/configure-inputs) |

| **Task Configuration:** | |
| ------------------------------- | ---------------------------------------------------------------------------------------------- |
| `extends` | N/A. The project configurations will always extend the `targetDefaults` defined in `nx.json`. |
| `pipeline[task].dependsOn` | [Same syntax](/reference/project-configuration#dependson). |
| `pipeline[task].dotEnv` | Define [file `inputs`](/reference/inputs#source-files) |
| `pipeline[task].env` | Define [env `inputs`](/reference/inputs#environment-variables) |
| `pipeline[task].passThroughEnv` | N/A. See [Defining Environment Variables](/recipes/tips-n-tricks/define-environment-variables) |
| `pipeline[task].outputs` | [Same syntax](/reference/project-configuration#outputs). |
| `pipeline[task].cache` | [Same syntax](/reference/project-configuration#cache) |
| `pipeline[task].inputs` | [Same syntax](/reference/inputs#source-files). |
| `pipeline[task].outputMode` | Use the [`--output-style` command line flag](/nx-api/nx/documents/run-many#output-style) |
| `pipeline[task].persistent` | N/A. |

| **Task Configuration:** | |
| ---------------------------- | ---------------------------------------------------------------------------------------------- |
| `extends` | N/A. The project configurations will always extend the `targetDefaults` defined in `nx.json`. |
| `tasks[task].dependsOn` | [Same syntax](/reference/project-configuration#dependson). |
| `tasks[task].env` | Define [env `inputs`](/reference/inputs#environment-variables) |
| `tasks[task].passThroughEnv` | N/A. See [Defining Environment Variables](/recipes/tips-n-tricks/define-environment-variables) |
| `tasks[task].outputs` | [Same syntax](/reference/project-configuration#outputs). |
| `tasks[task].cache` | [Same syntax](/reference/project-configuration#cache) |
| `tasks[task].inputs` | [Same syntax](/reference/inputs#source-files). |
| `tasks[task].outputLogs` | Use the [`--output-style` command line flag](/nx-api/nx/documents/run-many#output-style) |
| `tasks[task].persistent` | N/A. |
| `tasks[task].interactive` | N/A. |

## Command Equivalents

Expand Down
Loading