Turborepo 1.2

Friday, April 8th, 2022

Jared Palmer
Name
Jared Palmer
Twitter
@jaredpalmer
Becca Z.
Name
Becca Z.
Twitter
@becca__z
Gaspar Garcia
Name
Gaspar Garcia
Twitter
@gaspargarcia_
Greg Soltis
Name
Greg Soltis
Twitter
@gsoltis

Since releasing Turborepo v1.1 in late January, we've seen incredible adoption and community growth:

We've further improved ergonomics, observability, and security with Turborepo v1.2 featuring:

Update today by running npm install turbo@latest. After running turbo run for the first time, you'll see instructions about how to use @turbo/codemod to run automatic migrations for v1.2.

New Task Filtering API

We are excited to release one of our most requested features: the ability to expressively filter tasks through a --filter flag. The --filter flag is the much more powerful successor to the current combination of --scope, --include-dependencies, --since, and --no-deps flags.

With --filter you can tell turbo to restrict executing commands to a subset of matched packages in your monorepo based on name, folder, or even if it has changed since a git commit ref.

Take a look at some examples of what you can accomplish with the new --filter command:

  • --filter=<package_name> - match by exact package name or glob pattern
  • --filter=...<package_name>- match by package name/glob and include all dependent packages of matches
  • --filter=...^<package_name>- match by package name/glob and include all dependent packages of matches, but exclude the matches themselves
  • --filter=<package_name>... - match by package name/glob and include all the matched packages' dependencies
  • --filter=<package_name>^... - match by package name/glob and include all matched package dependencies, but exclude the matches themselves
  • --filter={./path/to/package} - match by path or filesystem glob pattern
  • --filter=[origin/main] - match by changed packages since a git commit ref

You can use multiple filters together to get even more granular filtering as well as combine each part of the above patterns {}, [] , ^ , and ... to express more complex behavior.

For example, if you had an app located in ./apps/web directory with local packages used as dependencies, and a Turborepo pipeline where test depends on ^build topologically, running:

turbo run test --filter={./apps/web}[HEAD^1]^...

would tell turbo to ensure dependencies are built and to run the test script in all of the local dependencies of the app located in ./apps/web, not including that app itself, if the app has changed since HEAD^1.

For more details and examples, refer to the new filtering documentation.

Debug and Automate with --dry-run

You can now see the impact of turbo run without actually executing any commands by appending either --dry-run or --dry-run=json to any turbo run command. This will result in either human or JSON output.

Dry runs are incredibly useful for two situations:

  • Debugging and testing run options
  • Using turbo filtering and task graphs for building automations

Turborepo Dry Run

We hope that this will improve visibility into what turbo is doing, speeding up debugging, and make it easier to leverage turbo in dynamic CI/CD systems.

Improved Internal Scheduler and Graph

When using turbo run, every package.json task is added to an internal graph to map dependencies based on the inferred relationships defined in your Turborepo pipeline. This task graph allows Turborepo to efficiently schedule incremental concurrent task running and cache task outputs for later use.

We have made major improvements to the internal task scheduler and resulting graph structure, resulting in better performance and a better developer experience. For example, in many cases, you will no longer need to use --include-dependencies. Instead, after specifying your task entry points, the new and improved graph will automatically handle this graph resolution on your behalf.

Cache Outputs Integrity and Signature Verification

You can now configure Turborepo to sign remote cache outputs using HMAC-SHA256 with a secret key before uploading them to the Remote Cache. When Turborepo downloads signed cache artifacts, it will now verify the artifact's integrity and authenticity. Any artifact that fails to verify will be ignored, discarded, and treated as a cache miss by Turborepo.

To enable this feature, set the remoteCache options in your turbo.json config file to include signature: true. Then specify your secret key by declaring the TURBO_REMOTE_CACHE_SIGNATURE_KEY environment variable.

{
  "$schema": "[https://turbo.build/schema.json](https://turbo.build/schema.json)",
  "remoteCache": {
    // Indicates if signature verification is enabled.
    "signature": true
  }
}

Other bug fixes and improvements

  • --sso-team flag now enables teams with SAML tokens to log in through turbo login with correct team permissions
  • --log-output flag allows you to control what logs are printed to the terminal, and when, allowing you to focus only on what's new
  • FORCE_COLOR environment variable is now supported
  • TURBO_FORCE=true environment variable will now force execution
  • --remote-only and TURBO_REMOTE_ONLY=true will tell turbo to only use Remote Caching
  • We now show >>> FULL TURBO when there's at least one task attempted
  • Yarn v2+ with Plug'n'Play (PnP linker) is supported for the turbo run command, but turbo prune is still not fully supported
  • Fixed regression with chrome tracing if --profile is specified
  • You can now set concurrency by percentage of CPUs with --concurrency=50%

We're hiring!

The Turborepo team at Vercel is hiring! We're up to five core team members already this year and are looking to hire even more. We're specifically looking for full-time Senior Build Systems Engineers.

What's next?

Along with seamless incremental adoption/migration and speeding up CI/CD, we've been focusing on improving Turborepo's day-to-day ergonomics, security, and observability. The new --filter flag, signed artifacts, and dry runs are important steps toward those goals.

Next up, we'll be focusing an enhanced local development experience, codebase automations, and overall CLI performance.

Thank you, contributors

Turborepo is the result of the combined work of over 95 individual developers and our core team.

This release was brought to you by the contributions of: @gsoltis09, @jaredpalmer, @gaspar09, @shuding, @rajatkulkarni95, @VanTanev, @Kikobeats, @tknickman, @thebanjomatic, @chelkyl, @elado, @finn-orsini, @becca, @weyert, @ekosz