Skip to content

Commit 24d6e39

Browse files
N-45divGuiBibeau
andauthored
feat: add API documentation generation with TypeDoc (#89)
* feat: add API documentation generation with TypeDoc - Add TypeDoc configuration for @solana/client package - Add docs and docs:json scripts for generating API documentation - Add CI workflow to build and publish docs to GitHub Pages - Generate markdown and JSON API specs from TypeScript/JSDoc - Add docs task to turbo.json Closes #85 * refactor: remove GitHub Pages deployment per review feedback - Remove workflow_dispatch trigger - Remove GitHub Pages deployment job - Keep TypeDoc generation with artifact upload - Docs will be deployed to solana.com in future PR * chore: add changeset for TypeDoc API documentation --------- Co-authored-by: Gui Bibeau <[email protected]>
1 parent 8982715 commit 24d6e39

File tree

7 files changed

+293
-28
lines changed

7 files changed

+293
-28
lines changed

.changeset/add-typedoc-api-docs.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solana/client": patch
3+
---
4+
5+
Add TypeDoc API documentation generation with JSON spec output

.github/workflows/docs.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Generate API Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/client/src/**'
9+
- 'packages/client/typedoc.json'
10+
- '.github/workflows/docs.yml'
11+
12+
jobs:
13+
build-docs:
14+
name: Build Documentation
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup pnpm
22+
uses: pnpm/action-setup@v4
23+
with:
24+
version: 10.20.0
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 24
30+
cache: pnpm
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Build packages
36+
run: pnpm build
37+
38+
- name: Generate API documentation
39+
run: pnpm --filter @solana/client docs
40+
41+
- name: Generate JSON API spec
42+
run: pnpm --filter @solana/client docs:json
43+
44+
- name: Upload docs artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: api-docs
48+
path: ./packages/client/docs
49+
retention-days: 30

packages/client/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
dist
1+
dist
2+
docs

packages/client/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
"build": "pnpm compile:js && pnpm compile:typedefs",
4848
"compile:js": "tsup --config ../build-scripts/tsup.config.package.ts",
4949
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
50+
"docs": "typedoc",
51+
"docs:json": "typedoc --json ./docs/api.json",
5052
"format": "biome check --write src",
5153
"lint": "biome check src",
5254
"test:typecheck": "tsc --noEmit -p tsconfig.test.json",
@@ -79,7 +81,9 @@
7981
"zustand": "catalog:utils"
8082
},
8183
"devDependencies": {
82-
"@types/node": "catalog:typescript"
84+
"@types/node": "catalog:typescript",
85+
"typedoc": "^0.28.0",
86+
"typedoc-plugin-markdown": "^4.4.0"
8387
},
8488
"peerDependencies": {
8589
"typescript": ">=5.3.3"

packages/client/typedoc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"entryPoints": ["./src/index.ts"],
4+
"out": "./docs",
5+
"name": "@solana/client API Documentation",
6+
"readme": "./README.md",
7+
"plugin": ["typedoc-plugin-markdown"],
8+
"outputFileStrategy": "modules",
9+
"excludePrivate": true,
10+
"excludeProtected": true,
11+
"excludeInternal": true,
12+
"includeVersion": true,
13+
"categorizeByGroup": true,
14+
"categoryOrder": ["Client", "Actions", "Hooks", "Types", "*"],
15+
"navigationLinks": {
16+
"GitHub": "https://github.com/solana-foundation/framework-kit"
17+
},
18+
"githubPages": true,
19+
"hideGenerator": true
20+
}

0 commit comments

Comments
 (0)