Back to blog

Turborepo 2.4

Friday, January 31st, 2025
Nicholas Yang
Name
Nicholas Yang
X
@nicholaslyang
Anthony Shew
Name
Anthony Shew
X
@anthonysheww
Chris Olszewski
Name
Chris Olszewski

Turborepo 2.4 includes a number of improvements to enhance your repository:

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

Boundaries Experimental

Turborepo is built on top of package manager Workspaces, leaning on ecosystem conventions as a part of determining your repository's task caching. However, this requires that all developers in the respository know and adhere to those conventions.

We're introducing Boundaries, an experimental feature to catch places in the repository where these best practices aren't being followed. This makes caching safer, and ensures your repository is prepared to use future Turborepo features safely.

Try it today using:

Terminal
turbo boundaries

This early iteration of Boundaries includes finding two types of monorepo mistakes:

Boundaries RFC

We look forward to hearing your feedback on the Boundaries RFC, which includes proposals for these built-in diagnostics as well as custom-built Boundaries.

To learn more, visit the documentation.

Terminal UI improvements

We've continued iterating on the terminal UI, originally released in Turborepo 2.0.

Persistent preferences

In previous versions of Turborepo, you would need to reset the terminal UI to your desired state every time you would run turbo. In Turborepo 2.4, we'll persist several of the UI selections that you've made, including:

Together, persisting these preferences creates a more seamless experience across turbo invocations, restoring the UI to the state from the previous run of turbo.

New keybinds

We've added more functionality to the terminal UI to make it easier to work with your tasks and logs.

Visit the documentation to learn more.

Watch Mode caching Experimental

Watch Mode is a monorepo-aware watcher that re-runs tasks according to your Task Graph. This opens up brand new ways to work in monorepos by leveraging a single, global, dependency-aware watcher, rather than many smaller, less powerful watcher scripts.

In this release, we're adding caching as an experimental feature in Watch Mode. To activate it, use the --experimental-write-cache flag:

Terminal
turbo run dev --experimental-write-cache

To learn more about Watch Mode, visit the documentation.

Circular dependency recommendations

Circular dependencies are loops in your package graph that create non-deterministic cycles in Turborepo's Task Graph. However, if there is a loop in your task graph, Turborepo is unable to determine which task comes before which, since they both depend on each other.

While adopting Turborepo in your monorepo, you may find circular dependencies as Turborepo create a more sophisticated, faster Task Graph than your previous task runner. Previously, Turborepo would naively list all of the packages involved in the cycle or cycles that exist in the repository's Package Graph. Now, Turborepo will include the dependency relationships that need to be broken up to get rid of the cycles in your graph.

Compare the before and after of the terminal printouts below:

Terminal
  × Invalid package dependency graph:
  ╰─▶ Cyclic dependency detected:
  │     @repo/logger, blog, storefront, @repo/ui
  │     The cycle can be broken by removing any of these sets of dependencies:
  │     { @repo/ui -> @repo/logger, @repo/ui -> storefront }
  │     { @repo/logger -> @repo/ui, @repo/ui -> storefront }

  ╰─▶   api, admin
        The cycle can be broken by removing any of these sets of dependencies:
        { admin -> api }
        { api -> admin }

schema.json in node_modules

A schema.json file provides auto-complete and validation in your editor for JSON files. We have a web-accessible version of the schema.json for turbo.json hosted at https://turbo.build/schema.json, but some developers prefer to get the file from node_modules to stay synced with the installed version of turbo.

Starting in this release, schema.json is available in node_modules once you've run your package manager's install command:

turbo.json
{
  "$schema": "./node_modules/turbo/schema.json"
}

node_modules location

We recommend installing turbo at the root of your repository, so the path for the schema should point to node_modules at the root of your repository. In Package Configurations, you may need to use a path like ../../node_modules/turbo/schema.json.

Visit the documentation for more information.

ESLint Flat Config support

Turborepo 2.4 introduces support for ESLint v9 in eslint-config-turbo and eslint-plugin-turbo, following the end-of life for ESLint v8 on October 5, 2024.

./packages/eslint-config/index.js
import turboConfig from 'eslint-config-turbo/flat';
 
export default [
  ...turboConfig,
  // Other configuration
];

The configuration and plugin remain backward compatible for those still using ESLint v8 to ensure a smooth transition.

For more information, visit the documentation.

Other changes

Acknowledgments and community

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

Thank you for your continued support, feedback, and collaboration to make Turborepo your build tool of choice. To learn how to get involved, visit the Community page.

We also thank everyone who contributed to this release of Turborepo: @aaronccasanova, @AlvaroParker, @ankur-arch, @arosequist, @atimmer, @bgw, @bitttttten, @chaficnajjar, @codexshell, @eps1lon, @gianelli99, @glitched-w0rld, @JasonnnW3000, @jbrocksfellas, @jeremy-code, @jonathandsouza, @Juneezee, @kayumuzzaman, @krlvi, @maciej-ka, @ognevny, @olets, @pkerschbaum, @romanofski, @shivam-pawar, @takaebato, @tevem1207, @thebrubaker, @Tofandel, @trivikr, @yamz8, and @zsh77.