Skip to content

Commit 851f5f1

Browse files
authored
ts(docs): Add typedoc to client hosted with GHPages (#648)
* cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines * cp dines
1 parent 71de54c commit 851f5f1

39 files changed

Lines changed: 2689 additions & 1343 deletions

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ module.exports = {
77
'unused-imports/no-unused-imports': 'error',
88
},
99
root: true,
10+
ignorePatterns: ['dist/**/*', 'docs/**/*', 'tests/**/*'],
1011
};

.github/PULL_REQUEST_TEMPLATE/bug_fix.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Examples: `fix: resolve memory leak` · `fix(api): handle null response` · `fix
1616

1717
## Changes
1818

19-
-
20-
-
19+
-
20+
-
2121

2222
## Testing
2323

@@ -32,4 +32,3 @@ Examples: `fix: resolve memory leak` · `fix(api): handle null response` · `fix
3232
- [ ] PR title follows Conventional Commits format (`fix:` or `fix(scope):`)
3333
- [ ] Root cause identified and documented
3434
- [ ] Tests added to prevent regression
35-

.github/PULL_REQUEST_TEMPLATE/feature.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Examples: `feat: add new SDK method` · `feat(storage): support file uploads` ·
1616

1717
## Changes
1818

19-
-
20-
-
19+
-
20+
-
2121

2222
## Testing
2323

@@ -37,4 +37,3 @@ Examples: `feat: add new SDK method` · `feat(storage): support file uploads` ·
3737
- [ ] PR title follows Conventional Commits format (`feat:` or `feat(scope):`)
3838
- [ ] Documentation updated (if needed)
3939
- [ ] Breaking changes documented (if applicable)
40-

.github/pull_request_template.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Examples: `feat: add new SDK method` · `feat(storage): support file uploads` ·
1616

1717
## Changes
1818

19-
-
20-
-
19+
-
20+
-
2121

2222
## Testing
2323

@@ -37,4 +37,3 @@ Examples: `feat: add new SDK method` · `feat(storage): support file uploads` ·
3737
- [ ] PR title follows Conventional Commits format (`feat:` or `feat(scope):`)
3838
- [ ] Documentation updated (if needed)
3939
- [ ] Breaking changes documented (if applicable)
40-

.github/workflows/publish-docs.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: PUBLISH DOCS
2+
on:
3+
workflow_dispatch:
4+
workflow_call:
5+
release:
6+
types: [published]
7+
permissions:
8+
contents: write # allows the 'Commit' step without tokens
9+
10+
jobs:
11+
get_history: # create an artifact from the existing documentation builds
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: get the gh-pages repo
15+
uses: actions/checkout@v3
16+
with:
17+
ref: gh-pages
18+
19+
- name: tar the existing docs
20+
run: |
21+
mkdir -p ./docs
22+
tar -cvf documentation.tar ./docs
23+
24+
- name: create a document artifact
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: documentation
28+
path: documentation.tar
29+
30+
build: # builds the distribution and then the documentation
31+
needs: get_history
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout src
35+
uses: actions/checkout@v3
36+
37+
- run: mkdir -p ./docs
38+
- name: Download the existing documents artifact
39+
uses: actions/download-artifact@v3
40+
with:
41+
name: documentation
42+
- run: tar -xf documentation.tar ./docs -C ./docs
43+
44+
- name: Build
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: 16.x
48+
cache: 'npm'
49+
- run: npm ci
50+
- run: npm run build # set up 'build' script in your package.json
51+
52+
- name: Build documents
53+
run: npm run docs #set up 'docs' build script in your package.json
54+
55+
- name: tar the new docs
56+
run: tar -cvf newdocumentation.tar ./docs
57+
58+
- name: create a new document artifact
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: newdocumentation
62+
path: newdocumentation.tar
63+
64+
commit: # commit the old and new merged documents to gh-pages/docs
65+
needs: build
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: checkout the gh-pages repo
69+
uses: actions/checkout@v3
70+
with:
71+
ref: gh-pages
72+
73+
- run: mkdir -p ./docs
74+
- name: Download the new documents artifact
75+
uses: actions/download-artifact@v3
76+
with:
77+
name: newdocumentation
78+
- run: tar -xf newdocumentation.tar ./docs -C ./docs
79+
80+
- name: commit
81+
run: |
82+
git config --global user.email "username@users.noreply.github.com"
83+
git config --global user.name "Continuous Integration"
84+
git add .
85+
git commit -m "CI updated the documentation"
86+
git push
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Object Smoke Test & Coverage Check
1+
name: SDK Smoke Tests & Coverage Check
22

33
on:
44
pull_request:
55
paths:
6-
- 'src/objects/**'
6+
- 'src/sdk/**'
77
- 'tests/smoketests/object-oriented/**'
88
workflow_dispatch:
99
inputs:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ dist-deno
1212
.DS_Store
1313
coverage-objects
1414
object-coverage-report.json
15+
docs

jest.config.objects.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
77
},
88
moduleNameMapper: {
9-
'^@runloop/api-client$': '<rootDir>/src/index.ts',
9+
'^@runloop/api-client$': '<rootDir>/src/sdk.ts',
1010
'^@runloop/api-client/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',
1111
'^@runloop/api-client/(.*)$': '<rootDir>/src/$1',
1212
},
@@ -18,9 +18,9 @@ module.exports = {
1818
],
1919
testMatch: ['**/tests/smoketests/object-oriented/**/*.test.ts'],
2020
collectCoverageFrom: [
21-
'src/objects/**/*.ts',
21+
'src/sdk/**/*.ts',
2222
'src/sdk.ts',
23-
'!src/objects/index.ts',
23+
'!src/sdk/index.ts',
2424
'!**/*.d.ts',
2525
'!**/node_modules/**',
2626
],

jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const config: JestConfigWithTsJest = {
1010
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
1111
},
1212
moduleNameMapper: {
13-
'^@runloop/api-client$': '<rootDir>/src/index.ts',
13+
'^@runloop/api-client$': '<rootDir>/src/sdk.ts',
1414
'^@runloop/api-client/_shims/auto/(.*)$': '<rootDir>/src/_shims/auto/$1-node',
1515
'^@runloop/api-client/(.*)$': '<rootDir>/src/$1',
1616
},

package.json

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "0.67.1",
44
"description": "The official TypeScript library for the Runloop API",
55
"author": "Runloop <support@runloop.ai>",
6-
"types": "dist/index.d.ts",
7-
"main": "dist/index.js",
6+
"types": "dist/sdk.d.ts",
7+
"main": "dist/sdk.js",
88
"type": "commonjs",
99
"repository": "github:runloopai/api-client-ts",
1010
"license": "MIT",
@@ -28,7 +28,11 @@
2828
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi",
2929
"tsn": "ts-node -r tsconfig-paths/register",
3030
"lint": "./scripts/lint",
31-
"fix": "./scripts/format"
31+
"fix": "./scripts/format",
32+
"docs": "typedoc --options typedoc.json",
33+
"docs:watch": "typedoc --options typedoc.json --watch",
34+
"predeploy-gh-pages": "yarn docs:sdk",
35+
"deploy-gh-pages": "gh-pages -d typedoc"
3236
},
3337
"dependencies": {
3438
"@types/node": "^18.11.18",
@@ -41,7 +45,12 @@
4145
"uuidv7": "^1.0.2",
4246
"zod": "^3.24.1"
4347
},
48+
"resolutions": {
49+
"typedoc": "^0.28.14",
50+
"typedoc-plugin-markdown": "^4.9.0"
51+
},
4452
"devDependencies": {
53+
"@shipgirl/typedoc-plugin-versions": "^0.3.2",
4554
"@swc/core": "^1.3.102",
4655
"@swc/jest": "^0.2.29",
4756
"@types/jest": "^29.4.0",
@@ -50,18 +59,25 @@
5059
"eslint": "^8.49.0",
5160
"eslint-plugin-prettier": "^5.0.1",
5261
"eslint-plugin-unused-imports": "^3.0.0",
62+
"gh-pages": "^6.3.0",
5363
"iconv-lite": "^0.6.3",
5464
"jest": "^29.4.0",
5565
"prettier": "^3.0.0",
5666
"ts-jest": "^29.1.0",
5767
"ts-node": "^10.5.0",
5868
"tsc-multi": "^1.1.0",
5969
"tsconfig-paths": "^4.0.0",
60-
"typescript": "^4.8.2"
70+
"typedoc": "^0.28.14",
71+
"typedoc-github-theme": "^0.3.1",
72+
"typedoc-material-theme": "^1.4.1",
73+
"typedoc-plugin-include-example": "^3.0.2",
74+
"typedoc-plugin-markdown": "^4.9.0",
75+
"typedoc-plugin-pages": "^1.1.0",
76+
"typescript": "^5.9.0"
6177
},
6278
"sideEffects": [
63-
"./_shims/index.js",
64-
"./_shims/index.mjs",
79+
"./_shims/sdk.js",
80+
"./_shims/sdk.mjs",
6581
"./shims/node.js",
6682
"./shims/node.mjs",
6783
"./shims/web.js",
@@ -105,11 +121,11 @@
105121
},
106122
".": {
107123
"require": {
108-
"types": "./dist/index.d.ts",
109-
"default": "./dist/index.js"
124+
"types": "./dist/sdk.d.ts",
125+
"default": "./dist/sdk.js"
110126
},
111-
"types": "./dist/index.d.mts",
112-
"default": "./dist/index.mjs"
127+
"types": "./dist/sdk.d.mts",
128+
"default": "./dist/sdk.mjs"
113129
},
114130
"./*.mjs": {
115131
"types": "./dist/*.d.ts",

0 commit comments

Comments
 (0)