# Docs build pipeline How `apps/docs` is built through the Turborepo task graph. There are no pnpm `pre`/`post` lifecycle hooks: ordering lives in `dependsOn` in `apps/docs/turbo.jsonc`. Verify against the current `apps/docs/turbo.jsonc` and `apps/docs/package.json` if behavior surprises you. Verified at: 3089aa3f67 (2026-11-25). ## Build flow ```mermaid flowchart TB subgraph turbo["Turborepo — apps/docs/turbo.jsonc"] direction TB WP["^build — workspace deps
(common, ui, config, icons, …)"] GQL["codegen:graphql"] EX["codegen:examples
copy ../../examples → apps/docs/examples"] CR["codegen:references
legacy + new (ensure, dart)
→ features/docs/generated/**, content/reference/**"] MD["build:markdown
build:guides-markdown (after build:federated-content)
+ build:reference-markdown"] GZ["build:gz-archive"] SM["build:sitemap"] RD["redirects:generate"] CR --> MD --> GZ WP --> DOC["docs#build — next build"] GQL --> DOC EX --> DOC CR --> DOC MD --> DOC GZ --> DOC SM --> DOC RD --> DOC end ``` ## Commands From the repo root: - **Full graph:** `pnpm build` → `turbo run build` (builds every package/app in dependency order). - **Docs only:** `pnpm build:docs` → `turbo run build --filter=docs`. ```json "build:docs": "turbo run build --filter=docs" ``` ## What Turbo does Root `turbo.jsonc` defines `build` with `dependsOn: ["^build"]`, so **workspace dependencies** of `docs` (e.g. `common`, `ui`, `config`, …) are built before `docs`. `apps/docs/turbo.jsonc` **extends** that and tightens the docs tasks: - **`build` also depends on** `codegen:graphql`, `codegen:examples`, `codegen:references`, `build:markdown`, `build:gz-archive`, `build:sitemap` and `redirects:generate`. - **`dev`** depends on `codegen:graphql`, `codegen:examples` and `codegen:references`. `typecheck` depends on `codegen:graphql`, `test` on `codegen:examples`, `test:smoke` / `embeddings` on `codegen:references`, `sync` on `codegen:graphql`, and `ingest:search_v2` on `build:guides-markdown` and `codegen:references`. - `codegen:references` has no script of its own: it groups `codegen:references:legacy` and `codegen:references:new`, and the latter depends on `codegen:references:new:ensure` and `codegen:references:dart`. `build:markdown` likewise groups `build:guides-markdown` and `build:reference-markdown`. - It lists **env vars** and `inputs` / `outputs` that affect caching for the docs app. Tasks that fetch remote content (`build:federated-content`, `codegen:references:new:ensure`) are uncached. `build:sitemap` is also uncached: it reads `` dates from the `last_changed` table, which the nightly last-changed workflow updates outside the task's inputs. Pipeline Turbo orchestrates for docs: **dependency packages → codegen → markdown / archive / sitemap / redirects → Next build**. ## The `maybe-turbo` wrapper The `docs` package has **no pnpm `pre` / `post` hooks**. Scripts that have prerequisites are wrapped with the `maybe-turbo` bin (`packages/maybe-turbo`), for example: ```json "build": "maybe-turbo next build --webpack" ``` `pnpm dev` runs `next dev` (Turbopack). The production build runs `next build --webpack`. A loader or bundler change must work in both. `next.config.mjs` has a `webpack` block and a `turbopack` block. Outside Turbo, `pnpm build`, `pnpm dev`, `pnpm codegen:references`, `pnpm ingest:search_v2` and friends re-invoke themselves as `turbo run