---
title: Turborepo 2.1
date: 2024/08/27
description: Turborepo 2.1 improves integration with your repository with affected package detection, and repository exploration tools.
tag: 'web development'
---

<h1 className="text-center">Turborepo 2.1</h1>

import { Authors } from '#components/authors';
import { Date } from '#components/blog/date';
import { Callout } from '#components/callout';

<Date>Tuesday, August 27th, 2024</Date>

<Authors
  authors={[
    'tomknickman',
    'anthonyshew',
    'chrisolszewski',
    'nicholasyang',
    'dimitrimitropoulos',
  ]}
/>

Turborepo 2.1 improves integration with your repository, with features like:

- [**Affected package graph detection**](#run-tasks-for-changed-packages-with---affected): Only run tasks with changes using `--affected`
- [**Repository exploration tools**](#repository-exploration-tools): Find packages and tasks faster with `turbo ls` and `turbo run`
- [**Terminal UI improvements**](#terminal-ui-improvements): Log selection, task search, resizing, and more
- [**Expanded configuration options**](#expanded-configuration-options): More flexibility for defaults using `turbo.json`

Update today by running `npx @turbo/codemod migrate` or get started with `npx create-turbo@latest`.

## Run tasks for changed packages with `--affected`

Turborepo’s [Remote Caching](/docs/core-concepts/remote-caching) shares a single cache across all of your machines,
so you never have to do the same work twice. But, what if you could ignore unchanged packages altogether?

You can now use the `--affected` flag with `turbo run` to automatically target packages with changes between the latest commit of your current branch, and the default branch of your repository (usually `main` or `master`).
`turbo` will use your [Package Graph](/docs/core-concepts/package-and-task-graph#package-graph) to ensure tasks are run for packages with direct changes or changes to internal dependencies.

```bash title="Terminal"
turbo run lint test --affected
```

You'll want to use this flag in situations like:

- You're running many tasks across packages in your monorepo, and only want to run those tasks in packages with code changes.
- You’re _not_ using a Remote Cache, but still want to do as little work as possible in CI.
- You _are_ using a Remote Cache, and you’re in a large repository. By minimizing the amount of tasks that will be restored from cache, there will be less data to send across the network, resulting in faster cache restoration.
- You’re already using [advanced filtering techniques](/docs/reference/run#advanced-filtering-examples) or [`turbo-ignore`](/docs/reference/turbo-ignore) to create the same or similar behavior as `--affected`. You likely have the opportunity to simplify your scripting using this new flag.

To learn more, [visit the documentation](/docs/reference/run#--affected).

## Repository exploration tools

As a repository grows and changes, it can be difficult to quickly find what you’re looking for.
We want to quickly surface your tasks, packages, and their relationships to make understanding your repository faster and easier.

### `turbo run`

Use `turbo run` (with no task arguments) to get a list of the available tasks in your repository. This command also works with [filters](/docs/crafting-your-repository/running-tasks#using-filters) and [Automatic Package Scoping](/docs/crafting-your-repository/running-tasks#automatic-package-scoping).

```bash title="Terminal"
# List all tasks in the repository
turbo run

# List tasks in a specific package
turbo run --filter=@repo/ui

# Using Automatic Package Scoping
cd packages/ui && turbo run
```

[Visit the documentation](/docs/reference/run) to learn more.

### `turbo ls`

Use `turbo ls` to get a list of all the packages in your repository with their locations, or filter to a specific package to see a summary of its internal dependencies and tasks.
`turbo ls` also supports `--filter`, and `--affected`, making it easy to gather a list of changed packages.

```bash title="Terminal"
# List all packages in the repository
turbo ls

# List dependencies and tasks for the `web` package
turbo ls web

## List affected packages
turbo ls --affected
```

<Callout>
  `turbo ls` supports an experimental `--output` flag that can be used to return
  results in a specific format. For example, `--output=json` can be used to more
  easily create inputs for other tools or custom scripts. If you were previously using
  `turbo build --dry=json` _only_ to retrieve a list of changed packages,
  give `turbo ls --affected --output=json` a try. Visit the docs for more information and
  leave feedback on output format on the `turbo ls`
[RFC](https://github.com/vercel/turborepo/discussions/8811).

</Callout>

[Visit the documentation](/docs/reference/ls) to learn more.

## Terminal UI Improvements

In Turborepo 2.0, we released a [new terminal UI](https://turborepo.com/blog/turbo-2-0#new-terminal-ui) to improve clarity for logs and allow for interactive tasks in local development. We heard your feedback, and prioritized polishing this UI, releasing improvements in patches to 2.0 and in this 2.1 release:

- Highlighting of logs for copying to clipboard ([PR](https://github.com/vercel/turborepo/pull/8713))
- Search through task list ([PR](https://github.com/vercel/turborepo/pull/9042))
- Cleaner layout resizing when your terminal changes size ([PR](https://github.com/vercel/turborepo/pull/8996))
- New icon for cache hits in task list ([PR](https://github.com/vercel/turborepo/pull/8869))
- Task status indicators updated when Watch Mode triggers a restart ([PR](https://github.com/vercel/turborepo/pull/8960))
- Output logs are respected after the terminal UI exits ([PR](https://github.com/vercel/turborepo/pull/8612))

Building a great terminal UI experience has unique challenges, and we’re continuing to iterate on this experience. We appreciate your continued feedback as we keep up our work on creating great UI for monorepos.

## Expanded configuration options

In this release, we’re adding more keys to `turbo.json` to give you more flexibility for your repository’s defaults. The following keys are new in this release:

```json title="turbo.json"
{
  "envMode": "loose",
  "daemon": false,
  "cacheDir": "./my-custom-directory/"
}
```

You may have been using the flag equivalents for these configurations on many or all of your `turbo` invocations, littering your codebase with commands like:

```bash title="Terminal"
turbo run build --env-mode=loose --no-daemon --cache-dir=./my-custom-directory
```

These can now be simplified with a centralized configuration in `turbo.json` using Turborepo’s existing configuration model:

- `turbo.json` sets the defaults for your repository.
- [System environment variables](/docs/reference/system-environment-variables) customize behavior in a specific environment.
- Flags customize behavior for specific invocations of `turbo`.

To learn more about available options and configurations, [visit the documentation](/docs/reference/configuration).

## Other improvements

- We’d like to especially thank [Shaharking](https://github.com/Shaharking) for their contribution in [#9023](https://github.com/vercel/turborepo/pull/9023) to make the colors for task names in streamed UIs deterministic, closing [#2564](https://github.com/vercel/turborepo/issues/2564). This makes it easier to compare tasks across `turbo run` invocations.

View the full changelog at [`vercel/turborepo`](https://github.com/vercel/turborepo/releases/tag/v2.1.0).

## Community

Since releasing [Turborepo 2.0](/blog/turbo-2-0) we've seen incredible adoption and community growth:

- [25.9k+ GitHub Stars](https://github.com/vercel/turbo)
- [2.9M+ weekly NPM downloads](https://www.npmjs.com/package/turbo)
- 428 years of compute time saved through [Remote Caching on Vercel](https://vercel.com/docs/concepts/monorepos/remote-caching)

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.
