docs-md
OpenPRA Unified Docs (VitePress + Doxybook2)
This package builds the unified Markdown documentation for the monorepo:
- TypeScript API via TypeDoc (Markdown output)
- C++ API via Doxygen XML converted by Doxybook2
- Site rendered with VitePress
Structure
- TS docs:
api/ts/web-editor— frontend utils subsetapi/ts/shared-sdk— runtime SDKapi/ts/shared-types— domain types and DTOsapi/ts/mef-types— MEF technical element typesapi/ts/model-generator— model generator utilitiesapi/ts/web-backend— NestJS backend (entry/main)api/ts/job-broker— job-broker microservice (entry/main)
- C++ docs:
api/cpp-doxybook2— structured pages (files/classes/namespaces)
- Site output:
.vitepress/dist
Explore src/ (by folder)
The site includes an "Explore src/ (by folder)" view for each TypeScript package. It groups TypeDoc modules by their top-level src/ folders to mirror the source tree and ease discovery. This is enabled by default and can be turned off by setting DOCS_ENABLE_SRC_EXPLORER=0 or DOCS_ENABLE_SRC_EXPLORER=false at build time.
Local usage
Recommended (faster dev loop):
- Generate docs content once
- Everything (TS + C++ processed and sanitized) in one go:
nx run docs-md:prepare --no-cloud
- TS-only (no Doxygen required):
- Quick:
nx run docs-md:ts:explore:folders --no-cloud- This runs all TypeDoc targets and generates the folder explorer without building the VitePress site.
- Or run individual packages if you’re iterating on a specific area:
nx run docs-md:ts:markdown --no-cloud(web-editor)nx run docs-md:ts:markdown:shared-sdk --no-cloudnx run docs-md:ts:markdown:shared-types --no-cloudnx run docs-md:ts:markdown:mef-types --no-cloudnx run docs-md:ts:markdown:model-generator --no-cloudnx run docs-md:ts:markdown:web-backend --no-cloudnx run docs-md:ts:markdown:job-broker --no-cloudnx run docs-md:ts:markdown:scram-node --no-cloud
- Quick:
- Everything (TS + C++ processed and sanitized) in one go:
- Start the dev server
nx run docs-md:site:dev --no-cloud
Full build and checks:
- Build once (no Nx Cloud):
nx run docs-md:site:build --no-cloud
- Link check (file-based):
nx run docs-md:site:link-check --no-cloud- Optionally seed more starting pages (relative to
.vitepress/dist/):DOCS_LINKCHECK_ENTRIES="api/ts/web-editor/_explore/index.html api/cpp-doxybook2/index_files.html" nx run docs-md:site:link-check --no-cloud
- Link check (serve-based, validates site-absolute links):
DOCS_LINKCHECK_SERVE=1 nx run docs-md:site:link-check --no-cloud- Port can be overridden:
DOCS_LINKCHECK_PORT=5173 DOCS_LINKCHECK_SERVE=1 nx run docs-md:site:link-check --no-cloud
To temporarily disable the folder explorer for a build:
DOCS_ENABLE_SRC_EXPLORER=0 nx run docs-md:site:build --no-cloud
Doxygen and Doxybook2
- Doxygen must be available on PATH (CI installs via apt). On Debian/Ubuntu:
sudo apt-get update && sudo apt-get install -y doxygen graphviz
- Doxybook2 is installed on demand by
tools/install-doxybook2.sh(Linux x86_64 v1.5.0).
Current scope
TypeScript
- frontend web-editor (selected utilities and related types):
src/utils/constants.tssrc/utils/scientificNotation.tssrc/utils/StringUtils.tssrc/utils/recalculateFrequencies.tssrc/utils/bayesianNodeIntersectionCalculator.tssrc/utils/faultTreeData.tssrc/utils/treeUtils.tssrc/app/components/treeNodes/faultTreeNodes/faultTreeNodeType.tssrc/app/components/treeNodes/eventSequenceNodes/eventSequenceNodeType.tssrc/app/components/treeEdges/eventSequenceEdges/eventSequenceEdgeType.ts
- shared-sdk:
src/index.ts(aggregated) - shared-types:
src/index.ts(aggregated) - mef-types:
src/index.ts(aggregated) - model-generator:
src/index.ts(aggregated) - web-backend:
src/main.ts(entrypoint) - job-broker:
src/main.ts(entrypoint)
C++
- Engine wrappers in
packages/engine/scram-node(headers) via Doxygen → Doxybook2.
Add more TS files incrementally by appending their paths to the --entryPointStrategy expand list in packages/docs-md/project.json under the ts:markdown command, then rebuild.
Adding a new TS package to the docs
To include another TypeScript package in the docs:
- Add a new
ts:markdown:<your-pkg>target inpackages/docs-md/project.jsonthat invokes TypeDoc with--entryPointStrategy expandagainst that package’ssrc. - Add the new target to the
dependsOnlist ofts:explore:foldersandprepareso it participates in the aggregate workflows. - Optionally add a sidebar entry to the VitePress nav for visibility.
CI publishing
.github/workflows/docs.yml builds docs-md:site:build and deploys .vitepress/dist to GitHub Pages on the default branch. The VitePress base path is configured via VITEPRESS_BASE="/$\{\{ github.event.repository.name \}\}/".
For incremental rollout and contribution steps, see CONTRIBUTING-DOCS.md in this folder.
Notes
- We removed Moxygen in favor of Doxybook2 (better structure and navigation).
- TypeDoc currently runs with
--skipErrorCheckingto keep generation fast; consider enabling error checking for docs builds later. - Generated artifacts and caches are ignored via root
.gitignore. - Base-path handling and link checks:
- We rely on VitePress
baseviaVITEPRESS_BASE; no custom prefixing in links. - Local link checks create an ephemeral symlink in
.vitepress/dist/<base>to emulate Pages base (both file- and serve-based modes); it is automatically cleaned up after the crawl to avoid dev server ELOOP issues.
- We rely on VitePress
Troubleshooting
- TypeDoc warnings
- “referenced by X but not included”: include the referenced file as another entry point, or export it via an aggregated index.
- “@param … was not used”: adjust the JSDoc to match the function signature or remove stale tags.
- SSR and braces in Markdown
- Avoid raw double braces in content (for example, GitHub Actions expressions). Use inline code or HTML entities like
{and}when showing literals.
- Avoid raw double braces in content (for example, GitHub Actions expressions). Use inline code or HTML entities like
