mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem `apps/docs` ordered its build, dev and codegen steps with pnpm `pre`/`post` hooks and `&&` chains. Turbo couldn't see those steps, so it couldn't cache or parallelize them, and running the build through turbo ran the codegen twice. Part of [FE-4948](https://linear.app/supabase/issue/FE-4948/migrate-the-pnpm-scripts-to-use-turbo). ## Solution The ordering now lives in `apps/docs/turbo.jsonc` as `dependsOn`, and every pre/post hook is gone. The new `maybe-turbo` workspace bin runs a script through `turbo run` unless it's already inside turbo, so `pnpm build`, `pnpm dev`, `pnpm codegen:references` and the other entry points keep running their prerequisites. Turbo is bumped to 2.11.10 for its `jit` input mode. Tasks downstream of the uncached remote fetches use it to hash the gitignored files those fetches write after they finish, so a cache hit can't restore output built from older content. Strict-mode env vars are declared. Other changes: - The R2 upload moves from `postbuild` to the `vercel.json` build command, so it still runs when the build is a cache hit. - `codegen:references:new:ensure` re-downloads when any JavaScript TypeDoc dump is missing or empty. - The guides manifest is now sorted, so its output is deterministic. - A new `turbo-scripts` agent skill (listed in `AGENTS.md`) documents these conventions for every app. Its audit script, `node .agents/skills/turbo-scripts/scripts/audit.mjs apps/<name>`, flags scripts that need `maybe-turbo`, leftover `pre`/`post` hooks, script chains, and wrapped scripts without a turbo task. ## Review instructions 1. Read `packages/maybe-turbo/README.md`, `apps/docs/turbo.jsonc` and `.agents/skills/turbo-scripts/SKILL.md`. 2. From `apps/docs`, set `GH_TOKEN=$(gh auth token)` for the federated fetch and run `pnpm run build:markdown` a few times. Once warm, every task except `build:federated-content` and `codegen:references:new:ensure` should hit the cache. 3. Run `pnpm build` from `apps/docs` and check that the docs Vercel preview deploys and renders normally. ## Checklist Check all before review: - [ ] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
61 lines
3.3 KiB
Markdown
61 lines
3.3 KiB
Markdown
# Developing Supabase Docs
|
|
|
|
## Getting started
|
|
|
|
Thanks for your interest in [Supabase docs](https://supabase.com/docs) and for wanting to contribute! Before you begin, read the
|
|
[code of conduct](https://github.com/supabase/.github/blob/main/CODE_OF_CONDUCT.md) and check out the
|
|
[existing issues](https://github.com/supabase/supabase/issues).
|
|
This document describes how to set up your development environment to contribute to [Supabase docs](https://supabase.com/docs).
|
|
|
|
For a complete run-down on how all of our tools work together, see the main DEVELOPERS.md. That readme describes how to get set up locally in lots of detail, including minimum requirements, our Turborepo setup, installing packages, sharing components across projects, and more. This readme deals specifically with the docs site.
|
|
|
|
> [!TIP]
|
|
> If you work at Supabase, branch this repo directly to make PRs. Don't use a fork. This lets the CI checks auto-run and speeds up review.
|
|
|
|
## Local setup
|
|
|
|
[supabase.com/docs](https://supabase.com/docs) is a Next.js site. You can get setup by following the same steps for all of our other Next.js projects:
|
|
|
|
1. Follow the steps outlined in the Local Development section of the main [DEVELOPERS.md](https://github.com/supabase/supabase/blob/master/DEVELOPERS.md)
|
|
2. If you work at Supabase, from `apps/docs` run `pnpm run dev:secrets:pull` to write internal env vars to `.env.local`. If you're a community member, create `apps/docs/.env.local` and add this line: `NEXT_PUBLIC_IS_PLATFORM=false`
|
|
3. Start the local docs site by navigating to `/apps/docs` and running `pnpm run dev`
|
|
4. Visit http://localhost:3001/docs in your browser - don't forget to append the `/docs` to the end
|
|
5. Your local site should look exactly like [https://supabase.com/docs](https://supabase.com/docs)
|
|
|
|
## AI friendly documentation
|
|
|
|
This project generates Markdown files for each page under `/docs/guides/..` path.
|
|
|
|
To test locally, within the `apps/docs` directory:
|
|
|
|
1. Run `pnpm build:guides-markdown`
|
|
2. Run `pnpm dev`
|
|
|
|
This creates Markdown files for all routes under the `public/markdown/guides` directory, ignored by Git.
|
|
|
|
For production this setup runs as a turbo dependency of `build` (see `turbo.jsonc`) to allow Vercel to bundle these files with middleware and functions.
|
|
|
|
## Accessibility checks
|
|
|
|
Docs pages are scanned for WCAG 2.1 A/AA issues with axe-core, as part of the
|
|
Playwright suite in `e2e/docs`. Pull requests scan the pages your change affects,
|
|
limited to the main article.
|
|
|
|
To scan the pages your current branch changes:
|
|
|
|
```bash
|
|
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm e2e:docs:a11y
|
|
```
|
|
|
|
That resolves which pages to scan from your branch, but reads them from
|
|
production, so it won't see your edits and will 404 on a page you just added.
|
|
Point `PLAYWRIGHT_BASE_URL` at your pull request's preview to scan your own
|
|
content.
|
|
|
|
See [`e2e/docs/README.md`](https://github.com/supabase/supabase/blob/master/e2e/docs/README.md)
|
|
for coverage and skipped rules.
|
|
|
|
## Contributing
|
|
|
|
For how to write a page, see the [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide). For repo organization, see the [contributing guide](https://github.com/supabase/supabase/blob/master/apps/docs/CONTRIBUTING.md). If you write with an AI coding agent, use the `/write-the-docs` skill to draft, `/edit-the-docs` to revise an existing page, and `/review-the-docs` to self-review before you open a PR.
|