Commit 80f17f4
Add API documentation with GitHub Pages deployment
This adds automated generation and deployment of versioned API documentation
using TypeDoc and GitHub Pages. Documentation will be generated and published
when a new release is created.
Changes
-------
1. **Documentation generation script** (see `scripts/generate-gh-pages.sh`)
Generates TypeDoc documentation for a specific version tag and commits it to
the gh-pages branch. The script uses git worktrees to isolate the
documentation generation process from the main workspace.
Documentation for each release is stored in a versioned directory (e.g.,
`v1.2.3/`) on the gh-pages branch. The script:
- Creates the gh-pages branch as an orphan branch if it doesn't exist
- Parses semantic versions from tag names, ignoring arbitrary prefixes
(e.g., tags `1.2.3`, `v1.2.3`, and `release-1.2.3` all create `v1.2.3/`)
- Preserves all existing version directories when generating new documentation
- Determines the latest version using semantic version sorting
- Copies static Jekyll template files from the `docs/` directory to the
gh-pages root (for the latest version only)
- Generates `_data/versions.yml` with a list of all versions for Jekyll
templates to consume
2. **Jekyll template files** (see `docs/` directory)
- `_config.yml` - Jekyll configuration (can set title and theme here)
- `index.md` - Landing page template that links to all versions based on
generated `_data/versions.yml`
- `latest/index.html` - Redirect page template that redirects to the latest
version based on generated `_data/versions.yml`
3. **GitHub Actions workflow** (see `.github/workflows/main.yml`)
Added a `publish-gh-pages` job that runs after the `publish` job on release
events. This ensures documentation is generated and published only after the
npm package is successfully published. The job invokes the generation script
with the release tag name and pushes the updated gh-pages branch.
4. **CI validation** (see `package.json`)
Updated the `check` script to include TypeDoc validation with `--emit none`.
This ensures TypeDoc can successfully parse the codebase (without generating
output), catching documentation issues early in CI.
5. **Documentation link** (see `README.md`)
Added a link to the published API documentation in the Documentation section
of the README.
TypeDoc Configuration
---------------------
TypeDoc is configured via `typedoc.json`:
- Uses the `src` directory as the entry point with the `expand` strategy
- Uses `tsconfig.prod.json` which excludes test files
Documentation URL
-----------------
Custom documentation will be available at:
https://modelcontextprotocol.github.io/typescript-sdk/
Versioned API documentation will be available at:
- https://modelcontextprotocol.github.io/typescript-sdk/latest/ (latest version)
- https://modelcontextprotocol.github.io/typescript-sdk/v1.2.3/ (specific versions)
Co-Authored-By: Claude <[email protected]>1 parent 5bcf53f commit 80f17f4
File tree
10 files changed
+429
-1
lines changed- .github/workflows
- docs
- latest
- scripts
10 files changed
+429
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1498 | 1498 | | |
1499 | 1499 | | |
1500 | 1500 | | |
| 1501 | + | |
1501 | 1502 | | |
1502 | 1503 | | |
1503 | 1504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments