Appearance
Maintaining these docs
This site has two layers:
| Layer | Location | Source of truth |
|---|---|---|
| Guides | docs/guide/core/*, docs/guide/react/*, plus shared pages | Written by hand |
| API reference | docs/api/ (generated) | TSDoc on public exports + TypeDoc |
Dual-track guides
Integrator docs are split by track:
| Track | Path | Audience |
|---|---|---|
| Core | docs/guide/core/ | Vanilla JS/TS via @swapped/connect-sdk |
| React | docs/guide/react/ | Provider + hooks via @swapped/connect-sdk/react |
Write track-specific pages (only that track’s code and steps). Keep the API reference shared. Shared guide topics (Formatters, Concepts) still live under both tracks with matching slugs so the Core / React toggle and sidebar stay available — put the canonical copy under docs/guide/core/… and <!--@include: …--> it from docs/guide/react/…. Stub pages at the old mixed paths (guide/getting-started.md, guide/react.md, guide/exchange-pay.md, guide/coinbase.md, guide/wallets.md) point readers to the new locations.
Top nav uses VitePress activeMatch so Core / React switch sidebars. Track pages also show a Core / React segmented toggle above the sidebar (docs/.vitepress/theme/TrackToggle.vue), which maps the current path after /guide/core|react/ to the other track (e.g. /guide/core/exchange-pay ↔ /guide/react/exchange-pay, /guide/core/wallets ↔ /guide/react/wallets, /guide/core/formatters ↔ /guide/react/formatters, and nested pages like /guide/core/coinbase/cooldown ↔ /guide/react/coinbase/cooldown).
Wallets, Coinbase, Exchange Pay, and Formatters guide pages live under docs/guide/{core,react}/… with matching slugs so the track toggle stays aligned. Keep the same top-level sidebar order in both tracks (guideItems in docs/.vitepress/config.mts).
React hook pages for Wallets, Exchange Pay, and Coinbase are grouped under a Hooks parent in the React sidebar (…/hooks/). Keep matching docs/guide/core/{section}/hooks/index.md stubs so the Core / React toggle does not 404 — do not list those stubs in the Core sidebar. Do not move individual hook files into a hooks/ folder — slugs must stay shared with Core (wallets/availability, coinbase/connection, …).
Commands
bash
npm run docs:api # regenerate docs/api from typedoc-entry/*
npm run docs:dev # API + local VitePress server
npm run docs:build # static site → docs/.vitepress/dist
npm run docs:preview # preview the production builddocs/api is gitignored; always run docs:api (or docs:dev / docs:build) before viewing the API section.
What to document
- Document symbols exported from
src/index.ts,src/react/index.ts, andsrc/format/index.ts. - Prefer TSDoc (
@param,@returns,@example,@remarks) on public APIs. - Keep internals unmarked or tagged
@internalso they stay out of the reference. - Entry wrappers for TypeDoc live in
typedoc-entry/(core,react, andformatmodules). - Group API reference entries with
@groupon the barrel re-exports insrc/index.ts/src/react/index.ts/src/format/index.ts(Client, Payment Methods, Wallets, Exchange Pay, Coinbase, Session, Events, Currency, Token, Numbers, etc.).