Turborepo启动器
这个Turborepo启动器由Turbo回购核心团队维护。
使用此示例
运行以下命令:
npx create-turbo@latest里面是什么?
此Turborepo包括以下软件包/应用程序:
应用程序和软件包
docs一 Next.js 应用web:另一个 Next.js 应用@expense/ui:两者共享的存根React组件库web和docs应用@expense/eslint-config:eslint配置(包括eslint-config-next和eslint-config-prettier)@expense/typescript-config:tsconfig.jsons在整个monorepo中使用
每个软件包/应用程序都是100% TypeScript.
公用事业
此Turborepo已经为您设置了一些附加工具:
- TypeScript 用于静态类型检查
- ESLint 用于代码过滤
- 更漂亮 用于代码格式化
构建
要构建所有应用程序和软件包,请运行以下命令:
cd my-turborepo
# With [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation) installed (recommended)
turbo build
# Without [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation), use your package manager
npx turbo build
yarn dlx turbo build
pnpm exec turbo build您可以使用 过滤器:
# With [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation) installed (recommended)
turbo build --filter=docs
# Without [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation), use your package manager
npx turbo build --filter=docs
yarn exec turbo build --filter=docs
pnpm exec turbo build --filter=docs开发
要开发所有应用程序和软件包,请运行以下命令:
cd my-turborepo
# With [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation) installed (recommended)
turbo dev
# Without [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation), use your package manager
npx turbo dev
yarn exec turbo dev
pnpm exec turbo dev您可以使用 过滤器:
# With [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation) installed (recommended)
turbo dev --filter=web
# Without [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation), use your package manager
npx turbo dev --filter=web
yarn exec turbo dev --filter=web
pnpm exec turbo dev --filter=web远程缓存
\[!提示\] Vercel Remote Cache对所有计划都是免费的。从今天开始 vercel.com.
Turborepo可以使用一种称为 远程缓存 跨机器共享缓存工件,使您能够与团队和CI/CD管道共享构建缓存。
默认情况下,Turborepo将在本地缓存。要启用远程缓存,您需要一个Vercel帐户。如果你没有账户,你可以 创建一个,然后输入以下命令:
cd my-turborepo
# With [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation) installed (recommended)
turbo login
# Without [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation), use your package manager
npx turbo login
yarn exec turbo login
pnpm exec turbo login这将使用您的身份验证Turborepo CLI Vercel帐户.
接下来,您可以从Turborepo的根目录运行以下命令,将Turborepos链接到远程缓存:
# With [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation) installed (recommended)
turbo link
# Without [global `turbo`](https://turborepo.dev/docs/getting-started/installation#global-installation), use your package manager
npx turbo link
yarn exec turbo link
pnpm exec turbo link实用链接
深入了解Turborepo的强大功能:
