apps/docs/content/blog/turbo-1-7-0.mdx
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
import TurboInferenceImage from "../../public/images/blog/turbo-1-7-0/turbo-inference.png";
import { Badge } from "@/components/ui/badge"; import { Authors } from "@/components/blog/authors"; import { Date } from "@/components/blog/date";
<Date>Wednesday, January 11th, 2023</Date>
<Authors authors={[ "gregsoltis", "nathanhammond", "tomknickman", "anthonyshew", "jaredpalmer", "mehulkar", "chrisolszewski", "nicholasyang", ]} />
Turborepo 1.7 focuses on improving developer experience by bringing more clarity to your tasks:
persistent: true to mark non-terminating tasks so that turbo can alert you if you have dependencies on them.Update today by running npm install turbo@latest, or by installing globally <Badge>NEW</Badge> and running the set-default-outputs codemod.
To avoid misconfigurations that could result in tasks that never run, you can now tell Turborepo about tasks that won't exit on their own (like dev scripts) with a persistent: true configuration option. When this config is set on a task, Turborepo will ensure no other task can depend on this task. This is useful for dev tasks or test runners with --watch flags.
{
"pipeline": {
"dev": {
+ "persistent": true
}
}
}
Previously, if Task B depended on a persistent Task A, Task B would never execute, because Task A never exited. By declaring Task A as persistent, Turborepo will prevent this error scenario from happening.
Before this release, we had been recommending the use of turbo run <task> --parallel for persistent tasks. With --parallel, turbo would ignore your dependency graph and execute all your tasks at once.
While --parallel did provide a helpful escape hatch, it meant that users had to tell Turborepo how to run their tasks rather than declaring what a task is.
Rather than throwing away your entire topological dependency graph, it's much more precise for Turborepo to keep your dependency graph while guaranteeing that you don't depend on a process that won't exit with persistent: true.
turboYou can now run your Turborepo tasks from anywhere in your project once you've installed turbo globally. To do so, use:
<Tabs items={["npm", "yarn", "pnpm"]} storageKey="selected-pkg-manager"> <Tab value="npm">
npm install turbo --global
turbo will now work in any project. To find your local turbo version, turbo will walk through a few steps, always looking upward from your current directory:
package.json with a workspaces property.package.json.Your globally installed version of turbo will only be used when a locally installed version of turbo does not exist or cannot be found.
<ThemeAwareImage light={{ alt: "Turborepo inference diagram showing how turbo finds your local turbo version", src: TurboInferenceImage, props: { width: 800, height: 400 }, }} dark={{ alt: "Turborepo inference diagram showing how turbo finds your local turbo version", src: TurboInferenceImage, props: { width: 800, height: 400 }, }} />
turbo --version and turbo bin will show you the version and binary location, respectively, of the copy of turbo that will execute your tasks.
Additionally, running with -vv or --verbosity=2 will always show if your local, or global turbo is being used.
turbo --version --verbosity=2
2023-01-11T10:49:04.042-0500 [DEBUG] turborepo_lib::shim: No local turbo binary found at: /Users/knickman/Developer/vercel/my-awesome-monorepo/node_modules/.bin/turbo
2023-01-11T10:49:04.042-0500 [DEBUG] turborepo_lib::shim: Running command as global turbo
1.7.0
outputs for improved clarityPreviously, if you did not specify an outputs key for a task, Turborepo would automatically attempt to cache all files in the dist/ and build/ directories.
This worked well for build tasks of specific frameworks, but this implicit behavior did not scale well as it applied to all tasks. We've found that, across the many developers, teams, projects, and codebases using Turborepo, the assumption to automatically cache dist/ and build/ directories was causing problems for users.
In version 1.7, this behavior is removed and you will now need to explicitly tell turborepo what to cache.
{
"pipeline": {
"build": {
+ "outputs": ["dist/**", "build/**"]
}
}
}
If you were relying on the default cache output in Turborepo versions below 1.7, you can get the same behavior by running the @turbo/codemod set-default-outputs codemod:
npx @turbo/codemod set-default-outputs
Also note that you will no longer need to specify outputs: [] because not caching anything is now the default behavior. The codemod will also remove this configuration from your tasks.
To bring visibility to errors, community member @dobesv contributed a solution to only show errors instead of all logs from a task run. While debugging a pipeline, --output-logs=errors-only can be used to keep your signal-to-noise ratio high so you can focus on ensuring successful runs for your pipelines.
This can be used as a configuration option or as a CLI flag
turbo build --output-logs=errors-only
Since releasing Turborepo v1.6 and merging with Turbopack, we've seen incredible adoption and community growth:
Turborepo is the result of the combined work of all of our contributors including our core team.
Thank you for your continued support, feedback, and collaboration to make Turborepo your build tool of choice.