Turborepo 2.2
Turborepo 2.2 brings a new repository query command, along with other improvements, including:
- Repository queries Experimental: Explore your repository like never before with
turbo query
- Improved cache safety: Easily diagnose and fix missing environment variable dependencies, and incorrect cache configurations
- Zero-configuration comparisons for affected packages: Automatically target packages with changes in GitHub workflows
Update today by running npx @turbo/codemod migrate
or get started with npx create-turbo@latest
.
Query your repository Experimental
In Turborepo 2.2, we're introducing turbo query
—a new command that
allows running GraphQL queries against Turborepo's repository data. Turborepo computes lots of data about your repository
in order to execute your tasks with maximum efficiency. This includes your package dependency graph, changed packages, task dependencies, log output from your tasks, and more.
This data can be useful for scripting, refactoring, determine what to run in CI, and discovering other insights into your codebase.
To get started, run turbo query
to open GraphiQL—a local IDE for writing GraphQL queries
that supports interactive schema exploration, documentation, and sending queries.
You can also pass queries directly as a string or file path:
Examples
Get the name and path for all affected packages that have a test
task.
Get a specific package and its direct dependencies.
Find all packages with more than 10 immediate dependents.
Turborepo has added APIs for structured data in the past, such as run summaries, dry run, and ls
.
However, these APIs have some limitations. First, they're centered around a single run, not general repository info. Second, as we added more fields, the output quickly became very large.
We needed a way to query repository data in a run-agnostic fashion, and make the returned data more customizable.
We would like to thank @maschwenk, @rafaeltab and @weyert for their early feedback on this feature.
To learn more, visit the documentation, and leave feedback for this new experimental command on the turbo query
RFC.
Improved cache safety
Caching tasks is one of the most powerful features of Turborepo, speeding up builds and other tasks by only re-running what has changed. With Turborepo 2.2, we're releasing some improvements to help configure cache inputs and outputs, and warn you when things don't look quite correct.
Platform environment variables
When deploying your applications, you likely already have environment variables configured in your production environment. Now, for supported platforms, Turborepo will
automatically check these environment variables against your turbo.json
configuration to ensure that you've correctly accounted for them,
and will warn you about any missing environment variables.
Any platform can support this feature by implementing the TURBO_PLATFORM_ENV
environment variable in to the build environment.
Vercel is supported today, and we will update documentation as more platforms become available.
Learn more about platform environment variables.
Warnings for empty cache configurations
When running tasks, Turborepo will now warn you if a task is configured to cache an empty directory. This can be a common mistake, and can lead to accidental broken builds. This is enabled by default in 2.2.
Learn more about configuring outputs.
Improvements to eslint-config-turbo
Turborepo automatically adds prefix wildcards to your env key for common frameworks. If you're using one of the supported frameworks, you don't need to specify environment variables that begin with the framework's prefix.
Now in Turborepo 2.2, eslint-config-turbo
supports this feature as well, ensuring the warnings from the plugin are accurate and actionable.
Learn more about eslint-config-turbo
.
Zero-configuration comparisons with --affected
In Turborepo 2.1, we released the --affected
flag which can be used with turbo run
and turbo ls
to automatically target changed packages.
In 2.2, we're taking it a step further by introducing automatic comparisons when running --affected
in a GitHub workflow—making common use cases even smarter.
- For workflows running in response to a pull request, the base of the comparison is automatically set to the base of the pull request. This ensures
turbo
considers any files changed in the pull request when determining the affected packages. - For workflows running in response to a push, the base of the comparison is automatically set to commit before your latest push.
Learn more about --affected
.
Community
Since releasing Turborepo 2.1 we've seen incredible adoption and community growth:
- 26.2k+ GitHub Stars
- 3.2M+ weekly NPM downloads
- 477 years of compute time saved through Remote Caching on Vercel
Turborepo is the result of the combined work of all of its contributors, including our core team.
View the full changelog.
Thank you for your continued support, feedback, and collaboration to make Turborepo your build tool of choice.