|  | 
| 1 |  | -# Website | 
|  | 1 | +# Skip Documentation Website | 
| 2 | 2 | 
 | 
| 3 |  | -The documentation website is built using [Docusaurus](https://docusaurus.io/). | 
|  | 3 | +This website is built using [Docusaurus](https://docusaurus.io/) and hosts both our documentation and blog. | 
| 4 | 4 | 
 | 
|  | 5 | +## API Documentation | 
| 5 | 6 | 
 | 
| 6 |  | -# API Documentation | 
|  | 7 | +The API documentation is generated using: | 
|  | 8 | +- [TypeDoc](https://typedoc.org/index.html) for API documentation generation | 
|  | 9 | +- [docusaurus-plugin-typedoc](https://typedoc-plugin-markdown.org/plugins/docusaurus) for Docusaurus integration | 
| 7 | 10 | 
 | 
| 8 |  | -The API docs are generated by [TypeDoc](https://typedoc.org/index.html) and integrated into docusaurus using [docusaurus-plugin-typedoc](https://typedoc-plugin-markdown.org/plugins/docusaurus). | 
| 9 |  | -This setup needs the development/source docs site to be in the same repo as the sources, as there are relative paths in the docusaurus config file to the sources. | 
| 10 |  | -A separate deployment step will be needed to generate the docs and push them to the repo that feeds the live site. | 
| 11 |  | -This also means that we can iterate on the docs in the source repo without publishing them immediately, and then choose to publish them in sync with publishing packages. | 
|  | 11 | +### Development Setup | 
| 12 | 12 | 
 | 
| 13 |  | -The workflow for working on API docs is: | 
| 14 |  | -``` | 
| 15 |  | -- $ cd /path/to/repo/root | 
| 16 |  | -- $ make docs                           # to initialize the api docs | 
| 17 |  | -- $ make docs-run                       # to run the docs site locally | 
| 18 |  | -- visit http://localhost:3000/docs/api/core | 
| 19 |  | -- edit the doc comments in the sources | 
| 20 |  | -- $ make docs                           # to regenerate the api docs | 
|  | 13 | +The development/source docs site must be in the same repository as the source code due to relative paths in the Docusaurus configuration. This setup allows us to: | 
|  | 14 | +- Iterate on documentation in the source repository | 
|  | 15 | +- Choose when to publish documentation | 
|  | 16 | +- Keep documentation in sync with package releases | 
|  | 17 | + | 
|  | 18 | +### Development Workflow | 
|  | 19 | + | 
|  | 20 | +#### Standard Workflow | 
|  | 21 | +```bash | 
|  | 22 | +# From repository root INSIDE your Docker instance | 
|  | 23 | +make docs           # Initialize API documentation | 
| 21 | 24 | ``` | 
| 22 |  | -A faster but not robust way to regenerate the api docs is: | 
|  | 25 | + | 
|  | 26 | +```bash | 
|  | 27 | +# From repository rood OUTSIDE your Docker instance | 
|  | 28 | +make docs-run       # Run the docs site locally | 
|  | 29 | +# Visit http://localhost:3000/docs/api/core or http://localhost/blog | 
|  | 30 | + | 
|  | 31 | +# After editing doc comments in the sources | 
|  | 32 | +make docs           # Regenerate API documentation | 
| 23 | 33 | ``` | 
| 24 |  | -- cd /path/to/repo/root/www && npx docusaurus generate-typedoc | 
|  | 34 | + | 
|  | 35 | +### Publishing Documentation | 
|  | 36 | + | 
|  | 37 | +Before, commit your changes and send them for review | 
|  | 38 | +```bash | 
|  | 39 | +git add <your_files> | 
|  | 40 | +git commit -m '<some message>' | 
|  | 41 | +gh pr create # if you use the GitHub CLI | 
| 25 | 42 | ``` | 
| 26 |  | -To publish the docs to the live site: | 
|  | 43 | + | 
|  | 44 | +When reviewed and mereged, rebase and clean up your repository: | 
|  | 45 | +```bash | 
|  | 46 | +git pull --rebase | 
|  | 47 | +git clean -Xdn # -n for a dry-run and double-check what's to be cleaned out | 
|  | 48 | +git clean -Xdf # the actual cleaning | 
| 27 | 49 | ``` | 
| 28 |  | -- $ make docs-publish | 
|  | 50 | + | 
|  | 51 | + | 
|  | 52 | +To publish documentation to the live site: | 
|  | 53 | +```bash | 
|  | 54 | +# From repository root INSIDE your Docker instance | 
|  | 55 | +git clean -Xdn #  | 
|  | 56 | +make docs-publish | 
| 29 | 57 | ``` | 
| 30 |  | -This will suggest to run: | 
|  | 58 | + | 
|  | 59 | +Note the the hash of your commit:  | 
|  | 60 | +```bash | 
|  | 61 | +git rev-parse --short HEAD # supposingly it is the last commit of the branch | 
| 31 | 62 | ``` | 
| 32 |  | -Test locally: make docs-serve | 
| 33 |  | -Push to live site: cd www/docs_site/; git add -A; git commit -m 'update to <commit>'; git push; cd - | 
|  | 63 | + | 
|  | 64 | +This will suggest running: | 
|  | 65 | +```bash | 
|  | 66 | +# Test locally | 
|  | 67 | +make docs-serve | 
|  | 68 | + | 
|  | 69 | +# Push to live site | 
|  | 70 | +cd www/docs_site/ | 
|  | 71 | +git add -A | 
|  | 72 | +git commit -m 'update to <hash_of_your_commit>' | 
|  | 73 | +git push | 
|  | 74 | +cd - | 
| 34 | 75 | ``` | 
| 35 |  | -Note that the docs_site commit messages will mention the wrong commit hashes if `make docs-publish` is run from a commit that is not (an ancestor of) `main`. | 
| 36 | 76 | 
 | 
| 37 |  | -The documentation for the tags that TypeDoc recognizes is | 
| 38 |  | -[here](https://typedoc.org/guides/tags/). | 
|  | 77 | +> **Note**: If `make docs-publish` is run from a commit that is not (an ancestor of) `main`, the docs_site commit messages will contain incorrect commit hashes. | 
|  | 78 | +
 | 
|  | 79 | +## Documentation Structure | 
| 39 | 80 | 
 | 
| 40 |  | -Once the docs site is running at http://localhost:3000, the markdown documentation under `www/docs` can be edited and the changes are usually picked up automatically. | 
|  | 81 | +- The markdown documentation under `www/docs` can be edited while the site is running at http://localhost:3000 | 
|  | 82 | +- Changes to the `www/docs` file structure must be reflected in `www/sidebars.ts` | 
|  | 83 | +- The `docusaurus.config.ts` file is sensitive to the file system locations of source entry points and tsconfig files | 
| 41 | 84 | 
 | 
| 42 |  | -Changes to the `www/docs` file structure usually need to be reflected in the `www/sidebars.ts` file. | 
|  | 85 | +## TypeDoc Tags | 
| 43 | 86 | 
 | 
| 44 |  | -The `docusaurus.config.ts` file is sensitive to the file system locations of the source entry points and tsconfig files. | 
|  | 87 | +For a complete reference of TypeDoc tags, see the [official documentation](https://typedoc.org/guides/tags/). | 
0 commit comments