Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHA-188] Added typedoc to package reqs. #107

Merged
merged 11 commits into from
Apr 30, 2024
43 changes: 43 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: API Reference
on:
pull_request:
push:
branches:
- main
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
deployments: write
id-token: write
contents: read
steps:
- uses: actions/checkout@v3

- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Install Package Dependencies
run: npm ci

- 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-labs-sdk-builds-ably-chat-js
role-session-name: "${{ github.run_id }}-${{ github.run_number }}"

- name: Upload Documentation
uses: ably/sdk-upload-action@v2
with:
sourcePath: typedoc/generated
githubToken: ${{ secrets.GITHUB_TOKEN }}
artifactName: typedoc
76 changes: 73 additions & 3 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 @@ -15,7 +15,8 @@
"build": "npm run build:mjs && npm run build:cjs",
"build:mjs": "tsc --project tsconfig.mjs.json && cp package.mjs.json dist/mjs/package.json",
"build:cjs": "tsc --project tsconfig.cjs.json && cp package.cjs.json dist/cjs/package.json",
"demo:reload": "npm run build && cd demo && npm i file:../"
"demo:reload": "npm run build && cd demo && npm i file:../",
"docs": "typedoc"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -46,6 +47,7 @@
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-security": "^1.7.1",
"prettier": "^3.2.5",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"vitest": "^1.4.0"
},
Expand Down
20 changes: 16 additions & 4 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"include": ["./src/**/*.ts"],
"exclude": ["./src/**/*.test.tsx", "./src/**/*.test.ts", "./src/fakes/**/*.ts"],
"include": [
"./src/**/*.ts"
],
"exclude": [
"./src/**/*.test.tsx",
"./src/**/*.test.ts",
"./src/fakes/**/*.ts"
],
"compilerOptions": {
"target": "es6",
"rootDir": "./src",
Expand All @@ -14,7 +20,13 @@
"skipLibCheck": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["node"]
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"types": [
"node"
]
}
}
25 changes: 25 additions & 0 deletions typedoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["src/index.ts"],
"out": "typedoc/generated",
"readme": "typedoc/landing-page.md",
"tsconfig": "tsconfig.base.json",
"treatWarningsAsErrors": false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is set to false as we have a lot of things to fix documentation-wise, but I've added all the validation in anyway so when running it locally you can just flick the switch and see what needs to be fixed.

"includeVersion": true,
"validation": true,
"requiredToBeDocumented": [
"Accessor",
"Class",
"Constructor",
"Enum",
"EnumMember",
"Function",
"Interface",
"Method",
"Parameter",
"Property",
"TypeAlias",
"Variable",
"Namespace"
]
}
10 changes: 10 additions & 0 deletions typedoc/landing-page.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ably Chat JavaScript Client Library SDK API Reference

The JavaScript Client Library SDK supports chat functionality over Ably. The JavaScript API references are generated
from the [Ably Chat JavaScript Client Library SDK source code](https://github.com/ably-labs/ably-chat-js)
using [TypeDoc](https://typedoc.org) and structured by classes.

The Chat SDK is built on top of the Ably Realtime SDK and provides a higher-level API for building chat applications. It
includes features such as entering/leaving conversations, sending messages, room reactions, presence, typing indicators,
and more.

Loading