Back to blog

Turborepo 2.0

Tuesday, June 4, 2024
Chris Olszewski
Name
Chris Olszewski
Nicholas Yang
Name
Nicholas Yang
X
@nicholaslyang

Turborepo 2.0 improves the developer experience of JavaScript and TypeScript repositories, with features including:

Update today by running npx @turbo/codemod migrate or get started with npx create-turbo@latest.

Visit the upgrading guide for update instructions. Breaking changes are listed below.

New terminal UI

In Turborepo 1.13, we released an experimental interface to learn how a refined terminal UI could improve development velocity. Through the RFC process, we were able to work with the community on designing a revamped local experience, driven by your feedback. Thank you to those who participated.

Today, we’re releasing the new UI as stable, along with the highly requested features that it enables.

Improved clarity for logs

Before 2.0, turbo would output logs as a stream while you were working on your libraries and applications. This could be overwhelming at times, since the intermixed logs made it difficult to understand what was going on with a specific task.

In this iteration of the UI, you can select individual tasks using your arrow keys to inspect their logs one at a time, making it easier to read the logs that you want to focus on.

Good to know:

The streamed logs view from prior versions of turbo is still available for local development by using the --log-order flag. Note that tasks will not be interactive with this option and some tools may clear the terminal unexpectedly.

Interactive tasks

Many tools allow for interacting with a script for important functionality. But, in previous versions of Turborepo, your scripts were trapped inside turbo so you couldn’t interact with them.

You can now enter the shell of individual tasks and pass inputs to your scripts via stdin by typing directly into the interface. This enables workflows like running specific test suites with Jest or Vitest, handling database migrations with Drizzle or Prisma, and much more.

To mark a task as interactive, add "persistent": true to its definition:

./turbo.json
{
  "tasks": {
    "dev": {
      "cache": false,
      "persistent": true
    }
  }
}

With the task selected in the UI, use the Enter key to enter the task’s shell and CTRL+Z to exit.

To learn more about persistent and interactive tasks, visit the documentation.

Watch Mode

Turborepo's ability to run many tasks at once gives you tighter feedback loops that help you ship faster. To get the most out of Turborepo's parallelization when working locally, your tools need to have a "watcher" feature available to re-run your code whenever you make changes. Unfortunately, many common tools don't, and most tools aren't monorepo-aware, leading to problems with scripts that depend on other scripts in your repository.

Today, we're releasing Watch Mode to bring this functionality to all your tooling:

Terminal
turbo watch dev lint test

Using turbo watch, Turborepo will re-run tasks whenever you make changes to your source code. Tasks will be ran using your dependency graph and configuration from turbo.json, just like turbo run.

Learn more about Watch Mode in the documentation.

All-new documentation

With this release, we’re also publishing revitalized documentation that builds on the strengths of prior versions. We’ve heard your feedback, so the docs now include:

Visit the Turborepo documentation.

Breaking changes

Visit the upgrading guide for instructions on how to update to 2.0.

Configuration

Breaking changes for turbo.json can be updated using npx @turbo/codemod migrate.

Correctness

Other

Community

We're excited to see the continued growth and adoption of Turborepo:

Turborepo is the result of the combined work of all of its contributors, including our core team: Anthony, Chris, Greg, Mehul, Mitch, Nicholas, and Tom.

Thank you for your continued support, feedback, and collaboration to make Turborepo your build tool of choice. If you haven't already, join the conversation on GitHub and Discord.