Skip to content

Commit

Permalink
feat(blog): 1.8 post
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman committed Feb 22, 2023
1 parent 0241014 commit 191b20f
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
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
118 changes: 118 additions & 0 deletions docs/pages/blog/turbo-1-8-0.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
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-7-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**](#schedule-your-long-running-tasks-with-confidence): You can now add a turbo.json configuration file in a workspace to override the root configuration in your repository.
- [**Automatic global `turbo` scoping**](#declare-your-outputs-for-improved-clarity): Global turbo now automatically infers your current workspace so that it only runs that workspace’s tasks.
- [**Migration codemod**](#global-turbo): 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 in workspace directories

This will enable teams to scale ownership of their monorepos by moving away from global configuration with 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/**"]
}
}
}
```

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 **aren’t** 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"`.
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)).

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

## Automatic Workspace Scoping

In [version 1.7](/blog/turbo-1-7-0), `turbo` became globally installable, giving you the power to run your tasks no matter where you are in your codebase. However, `turbo` would still run tasks from the root, running tasks that are in other workspaces that you may not have been intending.

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 your current workspace.

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

## Migrate easily using codemods

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.8](/blog/turbo-1-8-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 our contributors including our core team.

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

0 comments on commit 191b20f

Please sign in to comment.