Turborepo

create-turbo

開始使用 Turborepo 最簡單的方式是使用 create-turbo。使用此 CLI 工具可快速開始建置新的 monorepo,並為您設定好一切。

終端機
npx create-turbo@latest

從範例開始

社群策劃了一組範例,展示如何將常見工具和函式庫與 Turborepo 搭配使用。若要使用其中一個範例啟動您的 monorepo,請使用 --example 旗標

終端機
npx create-turbo@latest --example [example-name]

使用下列任何範例名稱

名稱說明
basic學習基本原理的最小 Turborepo 範例。
design-system透過在多個應用程式之間共用設計系統,統一您網站的外觀和風格。
kitchen-sink想看更深入的範例嗎?包含多個框架,包括前端和後端。
non-monorepo在沒有工作區的單一專案中使用 Turborepo 的範例
with-changesets預先設定透過 Changesets 發佈套件的簡單 Next.js monorepo
with-docker使用 Docker 部署並利用 turbo prune 的 Express API 和 Next.js 應用程式的 Monorepo
with-gatsby同時共用 UI 函式庫的 Gatsby.js 和 Next.js 應用程式的 Monorepo
with-prisma完全設定 Prisma 的 Next.js 應用程式的 Monorepo
with-react-native-web具有共用 UI 函式庫的簡單 React Native 和 Next.js monorepo
with-rollup具有單一 Next.js 應用程式,共用以 Rollup 捆綁的 UI 函式庫的 Monorepo
with-svelte具有多個 SvelteKit 應用程式,共用 UI 函式庫的 Monorepo
with-tailwind具有多個 Next.js 應用程式,共用 UI 函式庫,全部使用具有共用設定的 Tailwind CSS 的 Monorepo
with-vite具有多個以 Vite 捆綁的 Vanilla JS 應用程式,共用 UI 函式庫的 Monorepo
with-vue-nuxt具有 Vue 和 Nuxt,共用 UI 函式庫的 Monorepo

使用社群範例

您也可以使用 GitHub URL 來使用自訂入門程式或範例。這對於使用您自己的自訂入門程式或社群中的範例很有用。

終端機
npx create-turbo@latest --example [github-url]

選項

終端機
-m, --package-manager to use (choices: "npm", "yarn", "pnpm", "bun")

--skip-install: Do not run a package manager install after creating the project (Default: false)

--skip-transforms: Do not run any code transformation after creating the project (Default: false)

--turbo-version <version>: Use a specific version of turbo (default: latest)

-e, --example [name]|[github-url]: An example to bootstrap the app with. You can use an example name from the official Turborepo repo or a GitHub URL. The URL can use any branch and/or subdirectory

-p, --example-path <path-to-example>: In a rare case, your GitHub URL might contain a branch name with a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar). In this case, you must specify the path to the example separately: --example-path foo/bar

-v, --version:  Output the current version

-h, --help: Display help for command

小時

節省的總運算時間
開始使用
遠端快取 →

本頁內容