Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(blog): 1.8 post (#3913 #3913

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/pages/blog/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"typesetting": "article"
}
},
"turbo-1-8-0": "Turborepo 1.8",
"turbo-1-7-0": "Turborepo 1.7",
"turbopack-benchmarks": "Turbopack Performance Benchmarks",
"turbo-1-6-0": "Turborepo 1.6",
Expand Down
119 changes: 119 additions & 0 deletions docs/pages/blog/turbo-1-8-0.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: Turborepo 1.8
date: 2023/02/22
description: Turborepo 1.8 brings better flexibility and more control to your codebase by improving turbo's understanding of your workspaces.
tag: "web development"
ogImage: /images/blog/turbo-1-8-0/twitter-card.png
---

import { Tabs, Tab } from '../../components/Tabs'

# Turborepo 1.8

import { Authors } from '../../components/Authors'
import Badge from '../../components/Badge'
import Date from "../../components/blog/Date";

<Date>
Wednesday, February 22th, 2023
</Date>

<Authors authors={[
'gregsoltis',
'nathanhammond',
'tomknickman',
'anthonyshew',
'jaredpalmer',
'mehulkar',
'chrisolszewski',
'nicholasyang',
'alexanderlyon'
]} />

Turborepo 1.8 brings better flexibility and more control to your codebase by improving `turbo`'s understanding of your workspaces.

- [**Workspace Configurations**](#workspace-configurations): You can now add a `turbo.json` configuration file in a workspace to override the root configuration in your repository.
- [**Automatic Workspace Scoping**](#automatic-workspace-scoping): Global `turbo` now automatically infers your current workspace so that it only runs that workspace’s tasks.
- [**Easier Migrations**](#easier-migrations): Automatically migrate to new versions of `turbo` with `npx @turbo/codemod migrate`.

Update today by running `npx @turbo/codemod migrate`.

## Workspace Configurations

In workspace directories, you can now add a `turbo.json` to:

- add tasks specific to that workspace
- override configuration for tasks

This will enable teams to scale ownership of the projects in their monorepos by moving away from global configuration to fine-grain contol over tasks in workspaces.

For example, imagine your monorepo has a Next.js app and a SvelteKit app, and you want to use Turborepo to cache outputs of the `build` task. The Next.js `build` script creates a `.next` directory, whereas SvelteKit creates a `.svelte-kit` directory. Instead of adding both build directories in your root `outputs`, you can define the `outputs` key in the workspace instead:

```jsonc filename="turbo.json"
{
"pipeline": {
"build": {
"dependsOn": ["^codegen"],
// no need to define outputs here!
}
}
}
```

```jsonc filename="apps/my-nextjs-app/turbo.json"
{
"extends": ["//"],
"pipeline": {
"build": {
// dependsOn is inherited from root
"outputs": [".next/**"]
}
}
}
```

```jsonc filename="apps/my-sveltekit-app/turbo.json"
{
"extends": ["//"],
"pipeline": {
"build": {
// dependsOn is inherited from root
"outputs": [".svelte-kit/**"]
}
}
}
```

The `extends` key in the Workspace Configurations enables workspace owners to use the best of the root `turbo.json` and customize the parts that makes their app different (The `"//"` sigil will look familiar if you’re used to [defining tasks to run from your root](/repo/docs/core-concepts/monorepos/running-tasks#running-tasks-from-the-root)).

Keys that **are** declared will replace the key from the root if those keys exist, overriding what is defined in your root configuration. Keys that **are not** declared are inherited from the root config.

In the example above, `outputs` is customized for both apps, while `dependsOn` is configured by the root `turbo.json` and remains `"^codegen"`.

[Learn more in the docs](/repo/docs/core-concepts/monorepos/configuring-workspaces).

## Automatic Workspace Scoping

In [Turborepo v1.7](/blog/turbo-1-7-0), `turbo` became globally installable, giving you the power to run your tasks from anywhere in your codebase. However, `turbo` would still run tasks from the root, running tasks in other workspaces that you may not have intended to run.

With 1.8, `turbo` will automatically detect the workspace you are in and generate [the `--filter` syntax](/repo/docs/reference/command-line-reference#--filter) to scope your task to that workspace.

As an example, if your current directory is `apps/admin` and you use the `turbo build` command, `turbo` will run `turbo build --filter=admin` under the hood, focusing on the workspace that you are working on.

## Easier Migrations

Manually running individual codemods in the correct order is no longer required when upgrading Turborepo versions. `@turbo/codemod` now provides a simple `migrate` command which both upgrades your repo to the specified version (`latest` by default) of `turbo`, _and_ runs any codemods required.

Try it out now with `npx @turbo/codemod migrate`.

## Community

Since releasing [Turborepo v1.7](/blog/turbo-1-7-0) we've seen incredible adoption and community growth:

- [19.6k+ GitHub Stars](https://github.com/vercel/turbo)
- [987k weekly NPM downloads](https://www.npmjs.com/package/turbo)
- 42 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.