@algorandfoundation/algo-docs-sync
v1.5.0
Published
Documentation generation tools for AlgoKit TypeScript projects
Downloads
271
Maintainers
Keywords
Readme
@algorandfoundation/algo-docs-sync
End-to-end documentation tooling for AlgoKit projects. Install once, pick the documentation generator you need, and every build copies your guides, invokes the configured generator (TypeDoc today, more stacks tomorrow), writes manifest.json, and publishes the result to a dedicated docs branch.
1. Install & authenticate
- Add the tool as a dev dependency:
npm install --save-dev @algorandfoundation/algo-docs-sync
2. Scaffold the repo
Run the initializer from your project root and choose a generator (required). For TypeScript repos you’ll typically pass typedoc; future generators (e.g., Python/Sphinx) will expose their own templates.
npx algo-docs init --generator typedocThis command:
- Drops
docs-config.json(guide + API glob rules plus a requiredgeneratorfield) andtypedoc.jsonwhen using thetypedocgenerator. - Copies
.github/workflows/build-docs.yml, pre-wired with installation, build, manifest, and deploy steps. - Creates a
docs/folder if it doesn’t exist so you can start committing guide markdown right away.
Commit the generated files (docs-config.json, typedoc.json, .github/workflows/build-docs.yml) before moving on.
3. What the pipeline does
docs-config.json declares a generator and a basePath. Every run of npx algo-docs build dispatches to the selected generator. For the typedoc generator the flow is:
- Build – run TypeDoc (with
typedoc-plugin-markdown) to generate API docs atbasePath/api. - Stage –
npx algo-docs stagereads frombasePath/guidesandbasePath/api, applies include/exclude filters, and copies the results todocs-publish/<version>. - Manifest –
npx algo-docs manifestwritesbasePath/manifest.jsonincluding repo metadata, git info, and tool versions. - Publish – the workflow clones the current
docs-distbranch intodocs-publish, stages the filtered docs, and pushes the whole tree back viapeaceiris/actions-gh-pages.- Manual dispatches refresh only
docs-dist/latest. - Release events drop the new build into
docs-dist/v<tag>(e.g.,docs-dist/v1.3.5) and also refreshdocs-dist/latestso you always have a rolling view and versioned snapshots.
- Manual dispatches refresh only
Developers can explore the generated docs locally by opening the basePath/ directory, while CI keeps the branch copy in sync.
4. Wire up GitHub Actions
The initializer drops the build-docs.yml workflow into the .github.workflows/ folder.
Key secrets:
GITHUB_TOKEN(provided automatically) – used bypeaceiris/actions-gh-pagesto push todocs-dist. Ensure the repo’s Workflow permissions allow write access.
Once merged into your default branch, the workflow will:
- Update
docs-dist/lateston pushes, pull requests, and manual dispatches. - Create
docs-dist/<release-tag>when you publish a GitHub Release.
You can download the generated artifact (docs-dist.zip) from each run if you need to inspect the raw files.
5. Local commands
npx algo-docs validate– schema-checkdocs-config.json.npx algo-docs build– run TypeDoc to generate API docs atbasePath/api. Pass--generator <name>to override thegeneratorvalue declared indocs-config.json.npx algo-docs stage– copy and filter docs frombasePath/guidesandbasePath/apitodocs-publish/<version>. Use--version <tag>for versioned releases and--update-latestto also update the latest folder.npx algo-docs manifest– writebasePath/manifest.jsonwith repo metadata, git info, and tool versions.npx algo-docs migrate– update an existingdocs-config.jsonto the latest schema version.
These commands respect --config, --verbose, and --quiet flags so you can customize paths or diagnostics when experimenting locally.
7. Generators
The CLI ships with a pluggable generator system:
| Name | Description |
| -------- | ---------------------------------------------------------------- |
| typedoc | Builds API markdown from TypeScript entry points using TypeDoc and typedoc-plugin-markdown. |
Set the generator in docs-config.json (e.g., "generator": "typedoc") or via --generator on the CLI. Additional stacks (Python/Sphinx, Rust/mdBook, etc.) can plug in without changing the shared workflow—just ship a new generator package and register it.
6. Where your docs live
| Location | When it updates | What it contains |
| --------------------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| basePath/ (workspace) | After npx algo-docs build locally or in CI | Working copy of guides (at basePath/guides) and API markdown (at basePath/api). Safe to inspect or serve locally. |
| docs-publish/ (workspace) | After npx algo-docs stage | Filtered docs ready for publishing. Contains versioned folders (e.g., latest, v1.2.0). |
| docs-dist/latest (branch) | Manual dispatches and releases | Rolling view of the most recently published docs. Release runs refresh this folder in addition to their versioned snapshot. |
| docs-dist/<tag> (branch) | GitHub Release published | Immutable snapshot of the docs that correspond to that package version (e.g., v2.5.0). Useful for historic doc sets or version switchers. |
Publish targets can be adjusted by editing .github/workflows/build-docs.yml, but the defaults above cover most repos: "latest" for ongoing work, and "vX.Y.Z" for tagged releases.
