diff options
Diffstat (limited to 'docs/pages/MODEL/docs/getting-started/add-to-project.mdx')
| -rw-r--r-- | docs/pages/MODEL/docs/getting-started/add-to-project.mdx | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/docs/pages/MODEL/docs/getting-started/add-to-project.mdx b/docs/pages/MODEL/docs/getting-started/add-to-project.mdx deleted file mode 100644 index 7f7ecec..0000000 --- a/docs/pages/MODEL/docs/getting-started/add-to-project.mdx +++ /dev/null @@ -1,147 +0,0 @@ -import { Tabs, Tab } from '../../../../components/Tabs' - -# Add Turborepo to your existing project - -Turborepo can be used in **any project** to speed up the execution of scripts in your `package.json`. - -After you install `turbo`, you'll be able to run all your `package.json` tasks from `turbo` instead of your package manager. - -By configuring your `turbo.json` correctly, you'll notice how [caching](/AI/docs/core-concepts/caching) helps your tasks run a lot faster. - -## Quickstart - -0. **If you don't have one already, create a new application:** - -<Tabs items={['Next.js', 'Vite']} storageKey="selected-framework"> - <Tab> -```bash -npx create-next-app@latest -``` - </Tab> - <Tab> -```bash -npm create vite@latest -``` - </Tab> -</Tabs> - -1. **Install `turbo` globally:** - -<Tabs items={['npm', 'yarn', 'pnpm']} storageKey="selected-pkg-manager"> - <Tab> - ```bash - npm install turbo --global - ``` - </Tab> - <Tab> - ```bash - yarn global add turbo - ``` - </Tab> - <Tab> - ```bash - pnpm add turbo --global - ``` - </Tab> -</Tabs> - -For more details about installation, see [Installing Turborepo](../installing) - -2. **Add a `turbo.json` file at the base of your new repository:** - -For more information on configuring your `turbo.json`, see the [Configuration Options](/AI/docs/reference/configuration) documentation. - -<Tabs items={['Next.js', 'Vite']} storageKey="selected-framework"> - <Tab> -```json filename="turbo.json" -{ - "$schema": "https://turbo.build/schema.json", - "pipeline": { - "build": { - "outputs": [".next/**", "!.next/cache/**"] - }, - "lint": {} - } -} -``` - </Tab> - <Tab> -```json filename="turbo.json" -{ - "$schema": "https://turbo.build/schema.json", - "pipeline": { - "build": { - "outputs": ["dist/**"] - }, - "lint": {} - } -} -``` - -Some Vite starters ship with a `package.json` that looks like this: - -```json filename="package.json" -{ - "scripts": { - "build": "tsc && vite build" - } -} -``` - -We recommend splitting these into a `lint` and `build` script. - -```json filename="package.json" -{ - "scripts": { - "build": "vite build", - "lint": "tsc" - } -} -``` - -This means that Turbo can schedule them separately. - - </Tab> -</Tabs> - -3. **Edit `.gitignore`** - -Add `.turbo` to your `.gitignore` file. The CLI uses these folders for logs and certain task outputs. - -```diff -+ .turbo -``` - -4. **Try running `build` and `lint` with `turbo`:** - -```bash -turbo build lint -``` - -This runs `build` and `lint` at the same time. - -5. **Without making any changes to the code, try running `build` and `lint` again:** - -```bash -turbo build lint -``` - -You should see terminal output like this: - -``` - Tasks: 2 successful, 2 total -Cached: 2 cached, 2 total - Time: 185ms >>> FULL TURBO -``` - -Congratulations - **you just completed a build and lint in under 200ms**. - -To learn how this is possible, check out our [core concepts docs](/AI/docs/core-concepts/caching). - -6. **Try running `dev` with `turbo`:** - -```bash -turbo dev -``` - -You'll notice that your `dev` script starts up. You can use `turbo` to run any script in your `package.json`. |
