Skip to content

Commit

Permalink
Use TypeDoc to generate HTML documentation and upload to sdk.ably.com
Browse files Browse the repository at this point in the history
This is largely copied from the way we do things in ably-js (as of its
commit 76a5475).

I’ve made a couple of tweaks to the config, though:

- Added all types (except Project, which I have no idea how to
  document, and TypeLiteral, which would require us to split out every
  type literal into its own type, which we don’t want) to
  requiredToBeDocumented. I took the list from [1].

- Excluded internal and private stuff from documentation (see ccafd10).

[1] https://github.com/TypeStrong/typedoc/blob/f2d2abe054feca91b89c00c33e1d726bbda85dcb/src/lib/models/reflections/kind.ts#L7
  • Loading branch information
lawrence-forooghian committed Oct 17, 2023
1 parent 55d80d4 commit 9d726d8
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,31 @@ jobs:
node-version: 18
- run: npm ci
- run: npm run build
docs:
runs-on: ubuntu-latest
permissions:
id-token: write
deployments: write
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 18
- name: Install Package Dependencies
run: npm ci
- name: Build SDK
run: npm run build
- name: Build Documentation
run: npm run docs
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/ably-sdk-builds-spaces
role-session-name: "${{ github.run_id }}-${{ github.run_number }}"
- name: Upload Documentation
uses: ably/sdk-upload-action@v1
with:
sourcePath: docs/typedoc/generated
githubToken: ${{ secrets.GITHUB_TOKEN }}
artifactName: typedoc
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/
.vscode
coverage
.env
docs/typedoc/generated/

# Local Netlify folder
.netlify
Expand Down
5 changes: 5 additions & 0 deletions docs/typedoc/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ably Spaces SDK

This is the API reference for Ably’s Spaces SDK, generated with [TypeDoc](https://typedoc.org/).

To find out more about Spaces and how to get started, visit the [Ably documentation website](https://ably.com/docs/spaces).
168 changes: 168 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"build:mjs": "npx tsc --project tsconfig.mjs.json && cp res/package.mjs.json dist/mjs/package.json",
"build:cjs": "npx tsc --project tsconfig.cjs.json && cp res/package.cjs.json dist/cjs/package.json",
"build:iife": "rm -rf dist/iife && npx tsc --project tsconfig.iife.json && rollup -c",
"examples:locks": "ts-node ./examples/locks.ts"
"examples:locks": "ts-node ./examples/locks.ts",
"docs": "typedoc"
},
"exports": {
"import": "./dist/mjs/index.js",
Expand Down Expand Up @@ -52,6 +53,7 @@
"prettier": "^2.8.3",
"rollup": "^3.28.0",
"ts-node": "^10.9.1",
"typedoc": "^0.25.2",
"typescript": "^4.9.5",
"vitest": "^0.34.3"
},
Expand Down
34 changes: 34 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["dist/mjs/index.d.ts"],
"excludeInternal": true,
"excludePrivate": true,
"includeVersion": true,
"out": "docs/typedoc/generated",
"readme": "docs/typedoc/intro.md",
"requiredToBeDocumented": [
"Accessor",
"CallSignature",
"Class",
"Constructor",
"ConstructorSignature",
"Enum",
"EnumMember",
"Function",
"GetSignature",
"IndexSignature",
"Interface",
"Method",
"Module",
"Namespace",
"Parameter",
"Property",
"Reference",
"SetSignature",
"TypeAlias",
"TypeParameter",
"Variable",
],
"treatWarningsAsErrors": true,
"validation": true
}

0 comments on commit 9d726d8

Please sign in to comment.