Turborepo 2.4
Turborepo 2.4 includes a number of improvements to enhance your repository:
- Boundaries Experimental: A first look at Boundaries in Turborepo
- Terminal UI improvements: Persistent preferences and new features
- Watch Mode caching Experimental: Develop faster in Watch Mode
- Circular dependency recommendations: Adopt Turborepo in large repos more easily
schema.json
innode_modules
: Versioned configuration validation from within your repository- ESLint Flat Config support:
eslint-config-turbo
andeslint-plugin-turbo
updated for ESLint v9
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:
This early iteration of Boundaries includes finding two types of monorepo mistakes:
- Importing a file outside of the package's directory
- Importing a package that is not specified in dependencies
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:
- The task that you had previously selected will be pre-selected the next time you run
turbo
. Give your up and down arrow keys a rest. - Task list visibility, as described below
- Task selection pinning, as described below
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.
- h to toggle task list: You're often focused on one of your tasks, so you don't need to see your task list, all the time. Press the h key to show and hide the task list. This feature is a persistent preference, as described above.
- c to copy logs: Once you've highlighted a set of logs with your mouse, press c to copy the logs to your system clipboard.
- j and k to select tasks: You can now use j and k in addition to ↑ and ↓ to cycle through the task list. Vim users rejoice.
- p to pin the selected task: Selecting a task sets a "pin", meaning it will continue to be selected as your tasks change states. You can release the pin (or pin the task you're hovering) by pressing p. This feature is a persistent preference, as described above.
- u and d to scroll logs: You can now press u to scroll your logs up and d to scroll your logs down.
- m to learn more: Pressing m will show a popup listing all of the available keybinds.
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:
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:
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:
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.
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.