Turborepo 1.9

Turborepo 1.9

Monday, April 11th, 2023

Greg Soltis
Name
Greg Soltis
X
@gsoltis
Nathan Hammond
Name
Nathan Hammond
X
@nathanhammond
Tom Knickman
Name
Tom Knickman
X
@tknickman
Anthony Schew
Name
Anthony Schew
X
@anthonysheww
Jared Palmer
Name
Jared Palmer
X
@jaredpalmer
Mehul Kar
Name
Mehul Kar
X
@mehulkar
Chris Olszewski
Name
Chris Olszewski
Nicholas Yang
Name
Nicholas Yang
X
@nicholaslyang
Alexander Lyon
Name
Alexander Lyon
X
@_arlyon

Turborepo 1.9 focuses on improving observability for your task runs to better understand your caching behavior:

  • Run Summaries: Use the --summarize flag to generate a summary of your task to compare against previous runs.
  • Easier Starters: Use the --example flag with npx create-turbo to start from official Turborepo examples or custom repositories.
  • Strict Environments Experimental: Try enabling strict mode to restrict the environment variables your tasks have access to.

Update today by running npx @turbo/codemod migrate.

View and compare task runs

You can now produce a JSON summary of your task run using the --summarize flag:

turbo build --summarize

When this flag is enabled, Turborepo will generate a summary in .turbo/runs/ that contains all the information necessary to understand how turbo interpreted your your task's configuration and code.

Tasks:    3 successful, 3 total
Cached:   0 cached, 3 total
Time:     1.707s
Summary:  /Users/acme/projects/acme/.turbo/runs/2Nn3X6nWDhP9ag8BnmivWRxHpHC.json

You can then compare summaries using your favorite JSON diffing tool to understand why you got a cache hit or a cache miss.

Learn more in the docs.

Bring your own starter

create-turbo now supports starting a new project from any of the official Turborepo examples (opens in a new tab). Get started with an example using a single command:

npx create-turbo@latest -e kitchen-sink

In your terminal UI, choose your preferred package manager and create-turbo will automatically convert the chosen example to your package manager of choice.

Additionally, you can use create-turbo with custom repository sources, allowing you to re-use your own custom starter or another starter from around the community:

npx create-turbo -e https://github.com/your-org/turbo-starter

Strict Environments Experimental

You can now use the --env-mode=strict flag to restrict the environment variables your tasks have access to. Your tasks will only be aware of the variables you explicitly state, creating a safer caching environment.

In strict mode, Turborepo will pass environment variables declared in:

  • globalEnv and globalPassThroughEnv to all tasks
  • env and passThroughEnv for each task
{
  // Available to all tasks
  "globalPassThroughEnv": ["GLOBAL_VAR_1"],
 
  // Available to all tasks and invalidates caches
  "globalEnv": ["GLOBAL_VAR_2"],
 
  "pipeline": {
    "build": {
      // Only available to `build` tasks
      "passThroughEnv": ["VAR_1"],
 
      // Available to `build` task and invalidates caches
      "env": ["VAR_2"]
    }
  }
}

In strict mode, this configuration will only expose four environment variables to your build tasks, helping you catch missing variables earlier in the development process.

--env-mode also supports loose and infer.

Learn more in the docs.

Community

Since releasing Turborepo v1.8 we've seen incredible adoption and community growth:

Turborepo is the result of the combined work of all of its contributors, including our core team.

Thank you for your continued support, feedback, and collaboration to make Turborepo your build tool of choice.