Turborepo 1.1
Since releasing Turborepo v1.0 in mid-December, we've seen incredible adoption:
- 5.5k+ GitHub Stars
- 70k+ weekly npm downloads
- 65+ OSS contributors
- In production at Vercel, AWS, PayPal, Twilio, Contentful, Miro, Framer, Discord.js, Rocket.chat, Astro.build
- 585+ members of the Turborepo Community Discord
We're further improving build performance and caching with Turborepo v1.1, featuring:
- Automatic Migrations: Official idempotent migration scripts to assist with upgrading.
turbo.json
Support: Turborepo configuration now lives in its own file.- Faster Package Manager Detection: Turborepo now respects the
packageManager
key in the rootpackage.json
. - Environment Variable Dependencies: Define how environment variables impact global and task-specific caching.
- Partial Support for Yarn v2+: Support for yarn v2+ with
nodeLinker: "node-modules"
.
Update today by running npm install turbo@latest
. After running turbo
, you'll see instructions about how to use @turbo/codemod
to run automatic migrations for v1.1
.
Automatic Migrations
Turborepo now provides idempotent code transformations and automatic migration scripts (a.k.a "codemods") to help upgrade your Turborepo codebase when a feature is deprecated or will be deprecated in the future.
Codemods are transformations that run on your codebase programmatically. This saves you time by applying a large number of changes to your code automatically, without having to manually go through and edit every file.
Usage
transform
- the name of transform, see available transforms in the docs.path
- files or directory to transform.--dry
- Do a dry run, no code will be edited.--print
- Prints the changed output for comparison.
For more information about specific transforms, check out the new Codemods documentation.
turbo.json
Support
Turborepo configuration is now defined in a turbo.json
file in the root of your monorepo. This is an improvement over having a turbo
key in package.json
for those who want to quickly jump straight to their Turborepo configuration in their code editors.
To automatically migrate from your current configuration in package.json
, check out a new branch, navigate to the root of your monorepo and run the following codemod:
For more information on this transformation, check out the documentation.
Faster Package Manager Detection
Turborepo now supports the recently established packageManager
field in package.json
for faster package manager detection. Previously, turbo
would check for specific files to infer this information. To automatically set this field, check out a new branch, navigate to the root of your monorepo and run:
For more information on this transformation, check out the documentation.
Environment Variable Dependencies
When you use turbo
with tools that inline environment variables at build time (e.g. Next.js or Create React App), it is important you tell turbo
about it to avoid shipping a cached artifact with the wrong environment variables.
You can now control turbo
's cache fingerprinting (a.k.a. hashing) behavior based on the values of both environment variables and the contents of files:
- Including environment variables in a
dependsOn
in yourpipeline
definition prefixed by a$
will impact the cache fingerprint on a per-task or per-package-task basis. - Including environment variables in
globalDependencies
list prefixed by a$
will impact the cache fingerprint of all tasks. - Including files or globs of files in
globalDependencies
will impact the cache fingerprint of all tasks.
Note: In most monorepos, you don't often use environment variables in shared packages, but mostly in applications. Thus, to get higher cache hit rates, you should only include environment variables in the app-specific tasks where they are used/inlined.
For more information, read the caching and hashing documentation.
Partial Yarn v2/v3 support
In addition to Yarn v1, npm, and pnpm package managers, Turborepo now supports Yarn v2+ with nodeLinker: "node-modules"
set in .yarnrc.yml
. This key tells Yarn v2+ to mimic Yarn v1's node_modules
installation behavior. Yarn v2+ Plug'n'Play (a.k.a. "PnP") is not currently supported.
What's next?
Since our launch, Turborepo has focused on seamless incremental adoption/migration and speeding up CI/CD. We are committed to both of those values, but now we'll also be focusing on improving Turborepo's day-to-day ergonomics for local development and observability. We're really excited about this next chapter and will be sharing more details soon.
We're hiring!
The Turborepo team at Vercel is hiring! We're specifically looking for full time Senior Full Stack Software Engineers and Senior DevOps/Infrastructure Engineers to help us make Turborepo even better.