Skip to content

Maintaining these docs

This site has two layers:

LayerLocationSource of truth
Guidesdocs/guide/core/*, docs/guide/react/*, plus shared pagesWritten by hand
API referencedocs/api/ (generated)TSDoc on public exports + TypeDoc

Dual-track guides

Integrator docs are split by track:

TrackPathAudience
Coredocs/guide/core/Vanilla JS/TS via @swapped/connect-sdk
Reactdocs/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 build

docs/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, and src/format/index.ts.
  • Prefer TSDoc (@param, @returns, @example, @remarks) on public APIs.
  • Keep internals unmarked or tagged @internal so they stay out of the reference.
  • Entry wrappers for TypeDoc live in typedoc-entry/ (core, react, and format modules).
  • Group API reference entries with @group on the barrel re-exports in src/index.ts / src/react/index.ts / src/format/index.ts (Client, Payment Methods, Wallets, Exchange Pay, Coinbase, Session, Events, Currency, Token, Numbers, etc.).