简介

欢迎阅读 Turborepo 文档!

¥Welcome to the Turborepo documentation!


什么是 Turborepo?

¥What is Turborepo?

Turborepo 是一个适用于 JavaScript 和 TypeScript 代码库的高性能构建系统。它旨在扩展单一存储库,同时也能加快 单包工作区 中的工作流程。

¥Turborepo is a high-performance build system for JavaScript and TypeScript codebases. It is designed for scaling monorepos and also makes workflows in single-package workspaces faster, too.

从个人开发者到全球最大的企业工程组织,Turborepo 通过一种轻量级方法优化你需要在存储库中运行的任务,节省了数年的工程时间和数百万美元的计算成本。

¥From individual developers to the largest enterprise engineering organizations in the world, Turborepo is saving years of engineering time and millions of dollars in compute costs through a lightweight approach to optimizing the tasks you need to run in your repository.

monorepo 问题

¥The monorepo problem

Monorepos 有很多优势 - 但它们难以扩展。每个工作区都有自己的测试套件、自己的 linting 和自己的构建过程。单个 monorepo 可能有数千个任务要执行。

¥Monorepos have many advantages - but they struggle to scale. Each workspace has its own test suite, its own linting, and its own build process. A single monorepo might have thousands of tasks to execute.

A representation of a typical monorepo. The first application took 110 seconds to complete its tasks. The second application took 140 seconds to complete its tasks. The shared package between them took 90 seconds to complete its tasks.

这些速度下降会极大地影响你的团队构建软件的方式,尤其是在大规模构建时。反馈循环需要快速,以便开发者能够快速交付高质量的代码。

¥These slowdowns can dramatically affect the way your teams build software, especially at scale. Feedback loops need to be fast so developers can deliver high-quality code quickly.

monorepo 解决方案

¥The monorepo solution

The monorepo from before using Turborepo, showing how it can hit cache to complete tasks for all three packages in 80 milliseconds.

Turborepo 解决了你的 monorepo 的扩展问题。远程缓存 存储所有任务的结果,这意味着你的 CI 无需重复执行相同的工作。

¥Turborepo solves your monorepo's scaling problem. Remote Cache stores the result of all your tasks, meaning that your CI never needs to do the same work twice.

此外,在 monorepo 中,任务调度可能很困难。你可能需要先构建,然后测试,最后进行 lint……

¥Additionally, task scheduling can be difficult in a monorepo. You may need to build, then test, then lint...

Turborepo 会以最大速度调度你的任务,并在所有可用核心上并行执行工作。

¥Turborepo schedules your tasks for maximum speed, parallelizing work across all available cores.

Turborepo 可以逐步采用,你只需几分钟即可将其添加到任何存储库。它使用你已编写的 package.json 脚本、你已声明的依赖以及单个 turbo.json 文件。你可以将它与任何软件包管理器一起使用,例如 npmyarnpnpm,因为 Turborepo 依赖于 npm 生态系统的约定。

¥Turborepo can be adopted incrementally and you can add it to any repository in just a few minutes. It uses the package.json scripts you've already written, the dependencies you've already declared, and a single turbo.json file. You can use it with any package manager, like npm, yarn or pnpm since Turborepo leans on the conventions of the npm ecosystem.

如何使用这些文档

¥How to use these docs

我们将尽量减少专业术语的使用。 - 但在阅读文档时,有一些需要了解的术语很重要。我们创建了 词汇表页面 来帮助你,以防你正在学习这些术语。

¥We will do our best to keep jargon to a minimum - but there are some need-to-know words that will be important to understand as you read through the docs. We've created a glossary page to help you out in case you're learning about these terms.

加入社区

¥Join the community

如果你对 Turborepo 有任何疑问,欢迎随时在 GitHub 讨论Vercel 社区Twitter 社区提问。

¥If you have questions about anything related to Turborepo, you're always welcome to ask the community on GitHub Discussions, Vercel Community, and Twitter.