### Quickstart a Turborepo with Rsbuild example Source: https://turborepo.dev/docs/guides/frameworks/rsbuild Use the `create-turbo` CLI to quickly scaffold a new Turborepo monorepo pre-configured with an Rsbuild application. ```bash pnpm dlx create-turbo@latest -e with-rsbuild ``` ```bash yarn dlx create-turbo@latest -e with-rsbuild ``` ```bash npx create-turbo@latest -e with-rsbuild ``` ```bash bunx create-turbo@latest -e with-rsbuild ``` -------------------------------- ### Quickstart a Turborepo with Rsbuild Module Federation example Source: https://turborepo.dev/docs/guides/frameworks/rsbuild Use the `create-turbo` CLI to scaffold a new Turborepo monorepo pre-configured with Rsbuild Module Federation. ```bash pnpm dlx create-turbo@latest -e with-rsbuild-module-federation ``` ```bash yarn dlx create-turbo@latest -e with-rsbuild-module-federation ``` ```bash npx create-turbo@latest -e with-rsbuild-module-federation ``` ```bash bunx create-turbo@latest -e with-rsbuild-module-federation ``` -------------------------------- ### Initialize a new Turborepo project with an example Source: https://turborepo.dev/docs/reference/create-turbo Bootstrap your monorepo with one of the curated examples by using the `--example` flag. ```APIDOC ## Initialize a new Turborepo project with an example ### Description Bootstrap your monorepo with one of the curated examples by using the `--example` flag. You can use an example name or a GitHub URL. ### Method CLI Command ### Endpoint N/A ### Parameters #### Query Parameters - **--example** (string) - Required - 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. - **--example-path** (string) - Optional - 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. - **-m, --package-manager** (string) - Optional - The package manager to use (choices: "npm", "yarn", "pnpm", "bun"). - **--skip-install** (boolean) - Optional - Do not run a package manager install after creating the project (Default: false). - **--skip-transforms** (boolean) - Optional - Do not run any code transformation after creating the project (Default: false). - **--turbo-version** (string) - Optional - Use a specific version of turbo (default: latest). - **-v, --version** - Optional - Output the current version. - **-h, --help** - Optional - Display help for command. ### Request Example ```bash pnpm dlx create-turbo@latest --example [example-name] ``` ### Response #### Success Response (0) - Project scaffolded successfully with the specified example. #### Response Example ```txt Successfully created Turborepo project with example '[example-name]'. ``` ``` -------------------------------- ### Install Turborepo Globally with npm Source: https://turborepo.dev/docs/getting-started Install `turbo` globally using npm to run `turbo` commands from anywhere in your repository. This is the first step in getting started with Turborepo. ```bash npm install turbo --global ``` -------------------------------- ### Install Turborepo Globally with pnpm Source: https://turborepo.dev/docs/getting-started Install `turbo` globally using pnpm to run `turbo` commands from anywhere in your repository. This is the first step in getting started with Turborepo. ```bash pnpm add turbo --global ``` -------------------------------- ### Install Turborepo Globally with yarn Source: https://turborepo.dev/docs/getting-started Install `turbo` globally using yarn to run `turbo` commands from anywhere in your repository. This is the first step in getting started with Turborepo. ```bash yarn global add turbo ``` -------------------------------- ### Bootstrap Turborepo with an example using npm Source: https://turborepo.dev/docs/reference/create-turbo Initialize a new Turborepo project from a specific example using npm. ```bash npx create-turbo@latest --example [example-name] ``` -------------------------------- ### Bootstrap Turborepo with an example using bun Source: https://turborepo.dev/docs/reference/create-turbo Initialize a new Turborepo project from a specific example using bun. ```bash bunx create-turbo@latest --example [example-name] ``` -------------------------------- ### create-turbo CLI Options Source: https://turborepo.dev/docs/reference/create-turbo Reference for the available options for the `create-turbo` CLI, including package manager selection, skipping installations or transformations, specifying Turbo version, and using examples. ```txt -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 : 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 : 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 ``` -------------------------------- ### Install oxfmt with bun Source: https://turborepo.dev/docs/guides/tools/oxc Install oxfmt as a dev dependency using bun. ```bash bun add --dev oxfmt ``` -------------------------------- ### Bootstrap Turborepo with an example using pnpm Source: https://turborepo.dev/docs/reference/create-turbo Initialize a new Turborepo project from a specific example using pnpm. ```bash pnpm dlx create-turbo@latest --example [example-name] ``` -------------------------------- ### Bootstrap Turborepo with an example using yarn Source: https://turborepo.dev/docs/reference/create-turbo Initialize a new Turborepo project from a specific example using yarn. ```bash yarn dlx create-turbo@latest --example [example-name] ``` -------------------------------- ### Install oxlint with bun Source: https://turborepo.dev/docs/guides/tools/oxc Install oxlint as a dev dependency using bun. ```bash bun add --dev oxlint ``` -------------------------------- ### Initialize Prisma Turborepo Example Source: https://turborepo.dev/docs/guides/tools/prisma Use the create-turbo CLI to bootstrap a new project with Prisma pre-configured. ```bash npx create-turbo@latest -e with-prisma ``` -------------------------------- ### Bootstrap Turborepo with bun Source: https://turborepo.dev/docs/getting-started/examples Use `bunx create-turbo` to bootstrap a Turborepo with a specific example or a GitHub repository. Replace `[example-name]` with the desired example or `[github-url]` with a GitHub repository URL. ```bash bunx create-turbo@latest --example [example-name] # Use a GitHub repository from the community bunx create-turbo@latest --example [github-url] ``` -------------------------------- ### Nx Project Configuration Example Source: https://turborepo.dev/docs/guides/migrating-from-nx An example of an Nx project.json file, which defines project metadata and targets within an Nx workspace. ```json { "name": "starter", "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "apps/starter", "projectType": "application", "tags": [], "// targets": "to see all targets run: nx show project starter --web", "targets": {} } ``` -------------------------------- ### Bootstrap Turborepo with npm Source: https://turborepo.dev/docs/getting-started/examples Use `npx create-turbo` to bootstrap a Turborepo with a specific example or a GitHub repository. Replace `[example-name]` with the desired example or `[github-url]` with a GitHub repository URL. ```bash npx create-turbo@latest --example [example-name] # Use a GitHub repository from the community npx create-turbo@latest --example [github-url] ``` -------------------------------- ### Initialize a new Turborepo with SvelteKit Source: https://turborepo.dev/docs/guides/frameworks/sveltekit Use the with-svelte example to quickly bootstrap a new Turborepo project. ```bash pnpm dlx create-turbo@latest -e with-svelte ``` ```bash yarn dlx create-turbo@latest -e with-svelte ``` ```bash npx create-turbo@latest -e with-svelte ``` ```bash bunx create-turbo@latest -e with-svelte ``` -------------------------------- ### Install Turborepo with bun Source: https://turborepo.dev/docs/guides/single-package-workspaces Install Turborepo as a development dependency using bun. ```bash bun install turbo --dev ``` -------------------------------- ### Install oxfmt with pnpm Source: https://turborepo.dev/docs/guides/tools/oxc Install oxfmt as a dev dependency using pnpm. ```bash pnpm add --save-dev -w oxfmt ``` -------------------------------- ### Comprehensive Global Configuration Example Source: https://turborepo.dev/docs/reference/configuration Illustrates a complete `global` configuration block, requiring the `globalConfiguration` future flag. This example sets global `inputs`, `env` variables, `passThroughEnv` variables, `ui` mode, and `envMode`. ```jsonc { "futureFlags": { "globalConfiguration": true, }, "global": { "inputs": ["tsconfig.json", ".env"], "env": ["NODE_ENV"], "passThroughEnv": ["AWS_SECRET_KEY"], "ui": "tui", "envMode": "strict", }, } ``` -------------------------------- ### Travis CI configuration for npm Source: https://turborepo.dev/docs/guides/ci-vendors/travis-ci Basic Travis CI setup for a project using npm. Includes installing dependencies and running build and test scripts. ```yaml language: node_js node_js: - lts/* install: - npm install script: - npm run build script: - npm run test ``` -------------------------------- ### Initialize a new Nuxt Turborepo project Source: https://turborepo.dev/docs/guides/frameworks/nuxt Use the with-vue-nuxt example template to bootstrap a new Turborepo workspace. ```bash pnpm dlx create-turbo@latest -e with-vue-nuxt ``` ```bash yarn dlx create-turbo@latest -e with-vue-nuxt ``` ```bash npx create-turbo@latest -e with-vue-nuxt ``` ```bash bunx create-turbo@latest -e with-vue-nuxt ``` -------------------------------- ### Install oxfmt with npm Source: https://turborepo.dev/docs/guides/tools/oxc Install oxfmt as a dev dependency using npm. ```bash npm install --save-dev oxfmt ``` -------------------------------- ### Install oxfmt with yarn Source: https://turborepo.dev/docs/guides/tools/oxc Install oxfmt as a dev dependency using yarn. ```bash yarn add --dev oxfmt ``` -------------------------------- ### Run turbo devtools Source: https://turborepo.dev/docs/reference/devtools Starts a local server and opens the browser to visualize the monorepo package graph. ```bash turbo devtools [options] ``` -------------------------------- ### Install oxlint with pnpm Source: https://turborepo.dev/docs/guides/tools/oxc Install oxlint as a dev dependency using pnpm. ```bash pnpm add --save-dev -w oxlint ``` -------------------------------- ### Install oxlint with npm Source: https://turborepo.dev/docs/guides/tools/oxc Install oxlint as a dev dependency using npm. ```bash npm install --save-dev oxlint ``` -------------------------------- ### Bootstrap Turborepo with pnpm Source: https://turborepo.dev/docs/getting-started/examples Use `pnpm dlx create-turbo` to bootstrap a Turborepo with a specific example or a GitHub repository. Replace `[example-name]` with the desired example or `[github-url]` with a GitHub repository URL. ```bash pnpm dlx create-turbo@latest --example [example-name] # Use a GitHub repository from the community pnpm dlx create-turbo@latest --example [github-url] ``` -------------------------------- ### Add a component to the project Source: https://turborepo.dev/docs/guides/tools/shadcn-ui Use the add command to install specific components into your project. ```bash pnpm dlx shadcn@canary add [COMPONENT] ``` ```bash npx shadcn@canary add [COMPONENT] ``` ```bash npx shadcn@canary add [COMPONENT] ``` ```bash bunx shadcn@canary add [COMPONENT] ``` -------------------------------- ### Install Turborepo with npm Source: https://turborepo.dev/docs/guides/single-package-workspaces Install Turborepo as a development dependency using npm. ```bash npm install turbo --save-dev ``` -------------------------------- ### Install eslint-plugin-turbo with bun Source: https://turborepo.dev/docs/reference/eslint-plugin-turbo Install the package into the location where your ESLint configuration is held using bun. ```bash cd packages/eslint-config && bun install eslint-plugin-turbo --dev ``` -------------------------------- ### Install oxlint with yarn Source: https://turborepo.dev/docs/guides/tools/oxc Install oxlint as a dev dependency using yarn. ```bash yarn add --dev oxlint ``` -------------------------------- ### Install Turborepo with pnpm Source: https://turborepo.dev/docs/guides/single-package-workspaces Install Turborepo as a development dependency using pnpm. ```bash pnpm add turbo --save-dev ``` -------------------------------- ### Run Package Manager Install Command Source: https://turborepo.dev/docs/guides/migrating-from-nx Execute the package manager's install command to update the lockfile after configuration changes. ```bash pnpm install ``` ```bash yarn install ``` ```bash npm install ``` ```bash bun install ``` -------------------------------- ### Bootstrap Turborepo with yarn Source: https://turborepo.dev/docs/getting-started/examples Use `yarn dlx create-turbo` to bootstrap a Turborepo with a specific example or a GitHub repository. Replace `[example-name]` with the desired example or `[github-url]` with a GitHub repository URL. ```bash yarn dlx create-turbo@latest --example [example-name] # Use a GitHub repository from the community yarn dlx create-turbo@latest --example [github-url] ``` -------------------------------- ### Install Turborepo with yarn Source: https://turborepo.dev/docs/guides/single-package-workspaces Install Turborepo as a development dependency using yarn. ```bash yarn add turbo --dev ``` -------------------------------- ### Define Web Application Configuration Source: https://turborepo.dev/docs/crafting-your-repository/developing-applications Example package.json for a web application consuming local workspace packages. ```json { "name": "web" "scripts": { "dev": "next dev", "lint": "eslint ." }, "dependencies": { "@repo/ui": "workspace:*" } } ``` -------------------------------- ### Install Jest with pnpm Source: https://turborepo.dev/docs/guides/tools/jest Install Jest as a dev dependency for specific workspaces using pnpm. ```bash pnpm add jest --save-dev --filter=@repo/ui --filter=web ``` -------------------------------- ### Example turbo info output Source: https://turborepo.dev/docs/reference/info This is an example of the debugging information that the `turbo info` command outputs. It details the CLI, platform, and environment configurations. ```txt CLI: Version: 2.3.0 Path to executable: /path/to/turbo Daemon status: Running Package manager: pnpm Platform: Architecture: aarch64 Operating system: macos Available memory (MB): 12810 Available CPU cores: 10 Environment: CI: None Terminal (TERM): xterm-256color Terminal program (TERM_PROGRAM): tmux Terminal program version (TERM_PROGRAM_VERSION): 3.4 Shell (SHELL): /bin/zsh stdin: false ``` -------------------------------- ### Install eslint-plugin-turbo with npm Source: https://turborepo.dev/docs/reference/eslint-plugin-turbo Install the package into the location where your ESLint configuration is held using npm. ```bash npm i --save-dev eslint-plugin-turbo -w @acme/eslint-config ``` -------------------------------- ### Install Jest with npm Source: https://turborepo.dev/docs/guides/tools/jest Install Jest as a dev dependency for specific workspaces using npm. ```bash npm install jest --workspace=web --workspace=@repo/ui --save-dev ``` -------------------------------- ### Define Turborepo Build Script in package.json Source: https://turborepo.dev/docs/guides/ci-vendors/github-actions Example `package.json` demonstrating a `build` script that executes Turborepo's build command. ```json { "name": "my-turborepo", "scripts": { "build": "turbo run build" }, "devDependencies": { "turbo": "1.2.5" } } ``` -------------------------------- ### Start All Development Tasks with Turborepo Source: https://turborepo.dev/docs/getting-started/add-to-existing-repository Starts development tasks for all packages in a multi-package workspace using `turbo dev`. ```bash turbo dev ``` -------------------------------- ### Example package.json scripts Source: https://turborepo.dev/docs/guides/single-package-workspaces Define various scripts in `package.json` for database operations, type checking, and development server. ```json { "name": "@acme/my-app", "version": "0.0.0", "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint", "check-types": "tsc --noEmit", "db:up": "docker-compose up -d", "db:push": "your-orm-tool schema-push", "db:seed": "node ./db-seed.js" } } ``` -------------------------------- ### Root turbo.json with default task definitions Source: https://turborepo.dev/docs/reference/package-configurations This example shows a root `turbo.json` with basic task definitions for build, lint, and test, which can be inherited by other packages. ```jsonc { "tasks": { "build": {}, "lint": {}, "test": {}, }, } ``` -------------------------------- ### Install Jest with bun Source: https://turborepo.dev/docs/guides/tools/jest Install Jest as a dev dependency for specific workspaces using bun. This involves navigating to the workspace directory first. ```bash cd apps/web && bun install jest --dev cd packages/ui && bun install jest --dev ``` -------------------------------- ### Define UI Package Configuration Source: https://turborepo.dev/docs/crafting-your-repository/developing-applications Example package.json for a UI workspace package using TypeScript and ESLint. ```json { "name": "@repo/ui" "scripts": { "dev": "tsc --watch", "lint": "eslint ." } } ``` -------------------------------- ### Install Internal Package with pnpm Source: https://turborepo.dev/docs/core-concepts/internal-packages Use 'workspace:*' to reference an internal package when using pnpm. ```json { "dependencies": { "@repo/ui": "workspace:*" // [!code highlight] } } ``` -------------------------------- ### Example output for documentation search Source: https://turborepo.dev/docs/reference/docs The expected output format when running a search query. ```txt Found 5 results for 'caching': 1. Caching: https://v2-7-5.turborepo.dev/docs/core-concepts/caching 2. Remote Caching: https://v2-7-5.turborepo.dev/docs/core-concepts/remote-caching 3. Caching Tasks: https://v2-7-5.turborepo.dev/docs/crafting-your-repository/caching 4. Local Caching: https://v2-7-5.turborepo.dev/docs/core-concepts/local-caching 5. Cache Troubleshooting: https://v2-7-5.turborepo.dev/docs/troubleshooting/cache-issues ``` -------------------------------- ### Configure setup tasks before 'dev' Source: https://turborepo.dev/docs/crafting-your-repository/developing-applications Use 'dependsOn' in turbo.json to ensure setup tasks, like environment configuration or pre-building, run before the 'dev' task. This example shows a root task dependency for setup. ```json { "tasks": { "dev": { "cache": false, "persistent": true, "dependsOn": ["//#dev:setup"] }, "//#dev:setup": { "outputs": [".codegen/**"] } } } ``` -------------------------------- ### Turbo Devtools Command Source: https://turborepo.dev/docs/reference/devtools Starts a local server and opens your browser to a visualization of your monorepo's package graph. ```APIDOC ## turbo devtools ### Description Visualize your monorepo's package graph in the browser. ### Method CLI Command ### Endpoint N/A (CLI Command) ### Parameters #### Query Parameters - **--port** (number) - Optional - The port to run the devtools server on. Defaults to `9876`. - **--no-open** (boolean) - Optional - Do not automatically open the browser when the server starts. ### Request Example ```bash turbo devtools --port 3000 ``` ### Response #### Success Response (200) - **Visualization** (URL) - The URL to access the package graph visualization in the browser. #### Response Example ```bash turbo devtools ``` ``` -------------------------------- ### Get Turbo Binary Path Source: https://turborepo.dev/docs/reference/bin This command outputs the absolute path to the `turbo` binary. The output will differ based on whether you are using a globally installed `turbo` or a locally installed `turbo` within your repository. ```APIDOC ## GET /bin ### Description Retrieves the absolute path to the `turbo` binary. ### Method GET ### Endpoint /bin ### Request Example ```bash turbo bin ``` ### Response #### Success Response (200) - **path** (string) - The absolute path to the `turbo` binary. #### Response Example ```json { "path": "/path/to/your/turbo/binary" } ``` ``` -------------------------------- ### Configure Parameterized Paths for Routing Source: https://turborepo.dev/docs/guides/microfrontends Uses segments starting with `:` to match any single path segment. For example, `/blog/:slug` matches `/blog/hello` but not `/blog/hello/world`. ```json { "paths": ["/blog/:slug", "/users/:id/profile"] } ``` -------------------------------- ### Create Nx Workspace with Next.js Source: https://turborepo.dev/docs/guides/migrating-from-nx Command to scaffold a new Nx workspace configured with a Next.js application, serving as a starting point for the migration. ```bash npx create-nx-workspace --preset=next --ci=skip --e2eTestRunner=none --style=tailwind --nextAppDir=true --nextSrcDir=false --packageManager=pnpm --appName=starter ``` -------------------------------- ### ESLint Flat Config Custom Rules Source: https://turborepo.dev/docs/reference/eslint-plugin-turbo Configure specific rules for the turbo plugin within a Flat Config setup. This example enables the 'no-undeclared-env-vars' rule. ```javascript export default [ { plugins: { turbo, }, rules: { "turbo/no-undeclared-env-vars": "error", }, }, ]; ``` -------------------------------- ### Install UI package dependencies Source: https://turborepo.dev/docs/guides/tools/tailwind Commands to add the UI package and Tailwind configuration to the workspace using various package managers. ```bash pnpm add @repo/ui @repo/tailwind-config --save-dev --filter=@repo/ui --filter=web ``` ```bash yarn workspace web add @repo/ui @repo/tailwind-config --dev yarn workspace @repo/ui add @repo/ui @repo/tailwind-config --dev ``` ```bash npm install @repo/ui @repo/tailwind-config --workspace=web --workspace=@repo/ui --save-dev ``` ```bash cd apps/web && bun install @repo/ui @repo/tailwind-config --dev cd packages/ui && bun install @repo/ui @repo/tailwind-config --dev ``` -------------------------------- ### Dockerfile for Monorepo API Source: https://turborepo.dev/docs/guides/tools/docker This Dockerfile copies root package files, then the specific API package.json, before running npm install. This setup is common for deploying monorepo applications. ```docker FROM node:16 WORKDIR /usr/src/app # Copy root package.json and lockfile COPY package.json ./ COPY package-lock.json ./ # Copy the api package.json COPY apps/api/package.json ./apps/api/package.json RUN npm install ``` -------------------------------- ### Build compiled packages before linting Source: https://turborepo.dev/docs/guides/tools/oxc Example command to build compiled packages before running linting, ensuring type-aware linting rules function correctly. ```bash turbo run build --filter=./packages/* && turbo run lint ``` -------------------------------- ### Get the path to the turbo binary Source: https://turborepo.dev/docs/reference/bin Use this command to find the location of the turbo binary. The output path will differ based on whether turbo is installed globally or locally within your repository. ```bash turbo bin ``` -------------------------------- ### Global Turborepo Installation Source: https://turborepo.dev/docs/getting-started/installation Install Turborepo globally for flexible and fast local workflows. Use the same package manager as any existing global installation. ```bash pnpm add turbo --global ``` ```bash yarn global add turbo ``` ```bash npm install turbo --global ``` ```bash bun install turbo --global ``` -------------------------------- ### Create a new SvelteKit application Source: https://turborepo.dev/docs/guides/frameworks/sveltekit Run the SvelteKit creation command from the root of an existing repository. ```bash pnpm dlx sv create ``` ```bash yarn dlx sv create ``` ```bash npx sv create ``` ```bash bunx sv create ``` -------------------------------- ### Application package.json with Scripts Source: https://turborepo.dev/docs/guides/migrating-from-nx Create a package.json file for the starter application, defining standard development and build scripts. ```json { "name": "starter", "scripts": { "dev": "next dev", "build": "next build" } } ``` -------------------------------- ### Initialize a new Turborepo project Source: https://turborepo.dev/docs/reference/create-turbo Use `create-turbo` to quickly set up a new Turborepo repository from scratch. Choose your preferred package manager (pnpm, yarn, npm, bun). ```APIDOC ## Initialize a new Turborepo project ### Description Use `create-turbo` to quickly set up a new Turborepo repository from scratch. Choose your preferred package manager (pnpm, yarn, npm, bun). ### Method CLI Command ### Endpoint N/A ### Parameters #### Query Parameters - **--example** (string) - Optional - An example to bootstrap the app with. You can use an example name from the official Turborepo repo or a GitHub URL. - **--example-path** (string) - Optional - 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. - **-m, --package-manager** (string) - Optional - The package manager to use (choices: "npm", "yarn", "pnpm", "bun"). - **--skip-install** (boolean) - Optional - Do not run a package manager install after creating the project (Default: false). - **--skip-transforms** (boolean) - Optional - Do not run any code transformation after creating the project (Default: false). - **--turbo-version** (string) - Optional - Use a specific version of turbo (default: latest). - **-v, --version** - Optional - Output the current version. - **-h, --help** - Optional - Display help for command. ### Request Example ```bash pnpm dlx create-turbo@latest ``` ### Response #### Success Response (0) - Project scaffolded successfully. #### Response Example ```txt Successfully created Turborepo project. ``` ``` -------------------------------- ### Basic Dockerfile Instructions Source: https://turborepo.dev/docs/guides/tools/docker Standard Dockerfile commands for copying files, exposing ports, and defining the entrypoint for a Node.js application. ```docker COPY . . EXPOSE 8080 CMD [ "node", "apps/api/server.js" ] ``` -------------------------------- ### Create a new Turborepo project Source: https://turborepo.dev/docs/crafting-your-repository/caching Use this command to initialize a new Turborepo project. Follow the prompts to set up your project structure. ```bash npx create-turbo@latest ``` -------------------------------- ### Bootstrap Turborepo with a GitHub URL using npm Source: https://turborepo.dev/docs/reference/create-turbo Initialize a new Turborepo project from a GitHub URL using npm. This allows using custom starters or community examples. ```bash npx create-turbo@latest --example [github-url] ``` -------------------------------- ### Initialize a new Storybook Application Source: https://turborepo.dev/docs/guides/tools/storybook Initialize a new Storybook application within the current directory using the specified package manager. ```pnpm pnpm create storybook@latest ``` ```yarn yarn create storybook@latest ``` ```npm npm create storybook@latest ``` ```bun bun create storybook@latest ``` -------------------------------- ### Bootstrap Turborepo with a GitHub URL using bun Source: https://turborepo.dev/docs/reference/create-turbo Initialize a new Turborepo project from a GitHub URL using bun. This allows using custom starters or community examples. ```bash bunx create-turbo@latest --example [github-url] ``` -------------------------------- ### Install eslint-plugin-turbo with yarn Source: https://turborepo.dev/docs/reference/eslint-plugin-turbo Install the package into the location where your ESLint configuration is held using yarn. ```bash yarn workspace @acme/eslint-config add eslint-plugin-turbo --dev ``` -------------------------------- ### List all packages Source: https://turborepo.dev/docs/reference/ls Lists every package currently in the repository. ```bash # List all packages in the repository turbo ls ``` -------------------------------- ### Install eslint-plugin-turbo with pnpm Source: https://turborepo.dev/docs/reference/eslint-plugin-turbo Install the package into the location where your ESLint configuration is held using pnpm. ```bash pnpm add eslint-plugin-turbo --filter=@repo/eslint-config ``` -------------------------------- ### Install eslint-config-turbo Source: https://turborepo.dev/docs/reference/eslint-config-turbo Install the package into your ESLint configuration workspace using your preferred package manager. ```bash pnpm add eslint-config-turbo --filter=@repo/eslint-config ``` ```bash yarn workspace @acme/eslint-config add eslint-config-turbo --dev ``` ```bash npm install --save-dev eslint-config-turbo -w @acme/eslint-config ``` ```bash cd packages/eslint-config && bun install eslint-config-turbo --dev ``` -------------------------------- ### Install Jest with yarn Source: https://turborepo.dev/docs/guides/tools/jest Install Jest as a dev dependency for specific workspaces using yarn. ```bash yarn workspace web add jest --dev yarn workspace @repo/ui add jest --dev ``` -------------------------------- ### Create Module Federation Vite Project with bun Source: https://turborepo.dev/docs/guides/frameworks/vite Use this command to scaffold a Vite project with Module Federation support using bun. ```bash bunx create-turbo@latest -e with-vite-module-federation ``` -------------------------------- ### Initialize shadcn/ui in a monorepo Source: https://turborepo.dev/docs/guides/tools/shadcn-ui Run the initialization command to set up shadcn/ui within your monorepo environment. ```bash pnpm dlx shadcn@canary init ``` ```bash npx shadcn@canary init ``` ```bash npx shadcn@canary init ``` ```bash bunx shadcn@canary init ``` -------------------------------- ### Create Turborepo Project Source: https://turborepo.dev/docs/getting-started/installation Use this command to create a new Turborepo project with the basic starter. Choose your preferred package manager. ```bash pnpm dlx create-turbo@latest ``` ```bash yarn dlx create-turbo@latest ``` ```bash npx create-turbo@latest ``` ```bash bunx create-turbo@latest ``` -------------------------------- ### Initialize Nuxt in an existing repository Source: https://turborepo.dev/docs/guides/frameworks/nuxt Use the Nuxi CLI to scaffold a new Nuxt application within an existing apps directory. ```bash pnpm dlx nuxi@latest init apps/my-app ``` ```bash yarn dlx nuxi@latest init apps/my-app ``` ```bash npx nuxi@latest init apps/my-app ``` ```bash bunx nuxi@latest init apps/my-app ``` -------------------------------- ### Configure package entrypoints Source: https://turborepo.dev/docs/guides/tools/typescript Set up exports in package.json to expose compiled code to other workspace packages. ```json { "exports": { "./*": { ``` -------------------------------- ### Install Storybook React for UI Package Source: https://turborepo.dev/docs/guides/tools/storybook Installs `@storybook/react` as a development dependency in the `@repo/ui` package, which is required when co-locating stories with components. ```bash pnpm add @storybook/react --filter=@repo/ui --save-dev ``` ```bash yarn workspace @repo/ui add @storybook/react --dev ``` ```bash npm install @storybook/react --workspace=@repo/ui --save-dev ``` ```bash cd packages/ui && bun install @storybook/react --dev ``` -------------------------------- ### Repository Turborepo Installation Source: https://turborepo.dev/docs/getting-started/installation Install Turborepo as a devDependency in your repository root for consistent versions across all developers. This ensures stable usage. ```bash pnpm add turbo --save-dev --ignore-workspace-root-check ``` ```bash yarn add turbo --dev --ignore-workspace-root-check ``` ```bash npm install turbo --save-dev ``` ```bash bun install turbo --dev ``` -------------------------------- ### Bootstrap Turborepo with a GitHub URL using pnpm Source: https://turborepo.dev/docs/reference/create-turbo Initialize a new Turborepo project from a GitHub URL using pnpm. This allows using custom starters or community examples. ```bash pnpm dlx create-turbo@latest --example [github-url] ``` -------------------------------- ### Configure application styles and layout Source: https://turborepo.dev/docs/guides/tools/tailwind Integration steps for importing styles and PostCSS configuration into the application. ```css @import "tailwindcss"; @import "@repo/tailwind-config"; ``` ```tsx import "@repo/ui/styles.css"; import "./globals.css"; ``` ```js import { postcssConfig } from "@repo/tailwind-config/postcss"; export default postcssConfig; ``` -------------------------------- ### Install UI Package into Storybook Application Source: https://turborepo.dev/docs/guides/tools/storybook Install your monorepo's UI package into the Storybook application using the specified package manager. ```pnpm pnpm add @repo/ui --filter=storybook ``` ```yarn yarn workspace storybook add @repo/ui ``` ```npm npm install @repo/ui --workspace=storybook ``` ```bun cd apps/storybook && bun install @repo/ui ``` -------------------------------- ### Create a new Turborepo Monorepo Source: https://turborepo.dev/docs/guides/tools/storybook Initialize a new Turborepo monorepo project using the specified package manager. ```pnpm pnpm dlx create-turbo@latest ``` ```yarn yarn dlx create-turbo@latest ``` ```npm npx create-turbo@latest ``` ```bun bunx create-turbo@latest ``` -------------------------------- ### Install dependencies across multiple packages Source: https://turborepo.dev/docs/crafting-your-repository/managing-dependencies Commands to install a development dependency across multiple packages using various package managers. ```bash pnpm add jest --save-dev --recursive --filter=web --filter=@repo/ui --filter=docs ``` ```bash yarn workspace web add jest --dev yarn workspace @repo/ui add jest --dev ``` ```bash yarn workspaces foreach -R --from '{web,@repo/ui}' add jest --dev ``` ```bash npm install jest --workspace=web --workspace=@repo/ui --save-dev ``` ```bash cd apps/web && bun install jest --dev cd packages/ui && bun install jest --dev ``` -------------------------------- ### Vitest Shared Configuration Setup Source: https://turborepo.dev/docs/guides/tools/vitest Export shared Vitest test configuration, including globals, environment, and setup files. This configuration can be extended by individual projects. ```typescript export const sharedConfig = { test: { globals: true, environment: "jsdom", setupFiles: ["./src/test/setup.ts"], // Other shared configuration }, }; ``` -------------------------------- ### Get Remote Caching Status with cURL Source: https://turborepo.dev/docs/openapi/artifacts/status Sends a GET request to the `/artifacts/status` endpoint to check the remote caching status, using a Bearer token for authorization. ```bash curl -X GET "https://localhost:3000/artifacts/status" \ -H "Authorization: Bearer " ``` -------------------------------- ### Run build with npm Source: https://turborepo.dev/docs/crafting-your-repository/caching Execute the build script using npm. This command initiates a build process, and Turborepo will cache the results if the inputs haven't changed. ```bash npm run build ``` -------------------------------- ### Run quality checks and build with caching Source: https://turborepo.dev/docs/crafting-your-repository/constructing-ci Execute quality checks and build a specific application, leveraging Turborepo's caching to skip unchanged packages and dependencies. ```bash turbo run lint check-types test ``` ```bash turbo build --filter=web ``` -------------------------------- ### Run build with bun Source: https://turborepo.dev/docs/crafting-your-repository/caching Execute the build script using bun. This command leverages Turborepo's caching for build tasks. ```bash bun run build ``` -------------------------------- ### Example of Environment Variable Usage in Code Source: https://turborepo.dev/docs/crafting-your-repository/using-environment-variables An example demonstrating how an application might use an environment variable for API URLs. Ensure such variables are accounted for in `turbo.json` to avoid cache misses. ```typescript const data = fetch(`${process.env.MY_API_URL}/resource/1`); ```