Skip to content

Commit 198336b

Browse files
authored
feat: add typedoc support (#268)
This PR Generates documentation based on TypeScript types and deploys the docs using GH pages. How to test This was tested in a fork. The generated GH page can be seen [here](https://beeme1mr.github.io/js-sdk/). Signed-off-by: Michael Beemer <[email protected]>
1 parent fa6fb33 commit 198336b

File tree

9 files changed

+287
-72
lines changed

9 files changed

+287
-72
lines changed

.eslintrc.json

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,56 @@
11
{
2-
"env":{
3-
"browser":true,
4-
"es2021":true
2+
"env": {
3+
"browser": true,
4+
"es2021": true
55
},
6-
"extends":[
7-
"eslint:recommended",
8-
"plugin:@typescript-eslint/recommended",
9-
"prettier",
10-
"plugin:jsdoc/recommended"
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"prettier",
10+
"plugin:jsdoc/recommended"
1111
],
12-
"parser":"@typescript-eslint/parser",
13-
"parserOptions":{
14-
"ecmaVersion":"latest",
15-
"sourceType":"module"
12+
"parser": "@typescript-eslint/parser",
13+
"parserOptions": {
14+
"ecmaVersion": "latest",
15+
"sourceType": "module"
1616
},
17-
"plugins":[
18-
"@typescript-eslint",
19-
"check-file",
20-
"jsdoc"
17+
"plugins": [
18+
"@typescript-eslint",
19+
"check-file",
20+
"jsdoc"
2121
],
22-
"rules":{
23-
"linebreak-style":[
24-
"error",
25-
"unix"
26-
],
27-
"quotes":[
28-
"error",
29-
"single",
30-
{
31-
"avoidEscape": true
32-
}
33-
],
34-
"semi":[
35-
"error",
36-
"always"
37-
],
38-
"check-file/filename-naming-convention":[
22+
"rules": {
23+
"jsdoc/check-tag-names": [
24+
"warn",
25+
{
26+
"definedTags": [
27+
"experimental"
28+
]
29+
}
30+
],
31+
"linebreak-style": [
32+
"error",
33+
"unix"
34+
],
35+
"quotes": [
36+
"error",
37+
"single",
38+
{
39+
"avoidEscape": true
40+
}
41+
],
42+
"semi": [
43+
"error",
44+
"always"
45+
],
46+
"check-file/filename-naming-convention": [
3947
"error",
4048
{
41-
"**/*.{js,ts}":"KEBAB_CASE"
49+
"**/*.{js,ts}": "KEBAB_CASE"
4250
},
43-
{
44-
"ignoreMiddleExtensions": true
45-
}
51+
{
52+
"ignoreMiddleExtensions": true
53+
}
4654
]
4755
}
48-
}
56+
}

.github/workflows/release-please.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,41 @@ jobs:
1515
command: manifest
1616
token: ${{secrets.GITHUB_TOKEN}}
1717
default-branch: main
18+
outputs:
19+
release_created: ${{ steps.release.outputs.release_created }}
20+
release_tag_name: ${{ steps.release.outputs.tag_name }}
1821

22+
npm-release:
23+
needs: Release-please
24+
runs-on: ubuntu-latest
25+
if: ${{ needs.release-please.outputs.release_created }}
26+
steps:
1927
# The logic below handles the npm publication:
2028
- name: Checkout Repository
21-
if: ${{ steps.release.outputs.releases_created }}
2229
uses: actions/checkout@v3
2330
- name: Setup Node
2431
uses: actions/setup-node@v3
25-
if: ${{ steps.release.outputs.releases_created }}
2632
with:
2733
node-version: 16
28-
registry-url: 'https://registry.npmjs.org'
34+
registry-url: "https://registry.npmjs.org"
2935
- name: Build Packages
30-
if: ${{ steps.release.outputs.releases_created }}
3136
run: |
3237
npm ci
3338
npm run build
3439
35-
# Release Please has already incremented versions and published tags, so we just
3640
# need to publish all unpublished versions to NPM here
3741
# Our scripts only publish versions that do not already exist.
3842
- name: Publish to NPM
39-
if: ${{ steps.release.outputs.releases_created }}
4043
env:
4144
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
4245
run: npm publish --access public
46+
47+
- name: Build Docs
48+
run: npm run docs
49+
50+
- name: Deploy Documentation 🚀
51+
uses: JamesIves/github-pages-deploy-action@releases/v3
52+
with:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
BRANCH: gh-pages
55+
FOLDER: typedoc

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,7 @@ dist
105105

106106
# yalc stuff
107107
yalc.lock
108-
.yalc/
108+
.yalc/
109+
110+
# Ignore generated doc folder
111+
typedoc

0 commit comments

Comments
 (0)