Getting Started
Introduction
The Maia documentation depends on two libraries:
- VitePress
- ...a Static Site Generator (SSG) which takes source markdown, applies a theme and generates static HTML.
- TypeDoc
- ...converts comments in TypeScript into HTML documentation.
A markdown plugin (typedoc-plugin-markdown) enables comment-generated output HTML to be generated as markdown files and themed for VitePress.
TypeDoc must be added to each front end project, see below.
Run Locally
To run the documentation locally:
cd ./docs # if not already
pnpm install
pnpm devProject will open at http://localhost:5179/.
Add typedoc to a Project
Install
typedocwith the markdown and theme plugins:powershellcd <project> pnpm add typedoc typedoc-plugin-markdown typedoc-vitepress-theme --save-devAdd a
typedoc.jsonfile and add:json{ "plugin": ["typedoc-plugin-markdown", "typedoc-vitepress-theme"], "out": "../docs/<my-project>" }Where
<my-project>is the location of your documents in the documentation hierarchy.TIP
Note that a
typedoc-sidebar.jsonfile will be created at this location, which will help to configure navigation.WARNING
Ensure that the
outproperty points to the documentation folder (.\docin the root of thei-Coach Maiaproject).Add a
gendoctopackages.json, to run the document generator.json"scripts": { "dev": "vite", "build": "tsc -b ./tsconfig.lib.json && vite build", ... "gendoc": "typedoc" },In the
.\docsproject folder, tell the navigation about your new content (.\docs\.vitepress\config.mts):tsimport myProjectSidebar from "../api/typedoc-sidebar.json"; module.exports = { themeConfig: { nav: [{ text: "My Project", link: "/my-project/" }], // items for the top nav bar sidebar: [ // items for the left menu panel { text: "My Project", items: myProjectSidebar, }, ], }, };Once the projects are initialised, you will need to run
pnpm gendocto generate the markdown files from your project's comments.If you have a
README.md, it will be picked up as theindex.mdfor your project documentation.View your changes (see Run Locally) 🥳 😀
Commit and push the changes to your branch. Merge into
mainbranch. DONE.
WARNING
It is important to run a build pnpm build and a preview pnpm preview within the .\docs folder to ensure the build will succeed on the pipeline. Depending on confuguration, even dead links will fail the build...
Deployment
The CI folder in the i-Coach Maia project contains a pipeline to deploy the documentation to an Azure static web app.
- Pull Requests into the
mainbranch will trigger the build and deploy. - The deployment is hosted here, https://gentle-water-099049303.7.azurestaticapps.net/