Skip to content

Commit 22117c2

Browse files
docs: autogenerated typedoc reference (#2308)
1 parent dd797cf commit 22117c2

20 files changed

+244
-200
lines changed

.github/maintainers_guide.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ We have included `launch.json` files that store configuration for `vscode` debug
2929

3030
See the [Docs README](https://github.com/slackapi/node-slack-sdk/blob/main/docs/README.md) for information on how the docs site work.
3131

32-
The reference docs are generated on every site build, pulling from this repo's files. The site is built automatically on every release via `docs-deploy.yml`.
32+
The reference docs for each package is independent of the others. They're generated using `typedoc` and `typedoc-plugin-markdown`. In each package's `package.json` there's a `docs` command that generates reference docs for that package based on the configuration settings found in `/package-name/typedoc.json`.
33+
34+
The script places the reference markdown files in `/reference/package-name`.
3335

3436
### 🚀 Releases
3537
_For beta releases, see [**Beta Releases**](https://github.com/slackapi/node-slack-sdk/blob/main/.github/maintainers_guide.md#-beta-releases) section below_
@@ -50,38 +52,40 @@ Releasing can feel intimidating at first, but rest assured: if you make a mistak
5052

5153
4. For each package to be released, run `npm run test` to verify that tests are passing and code is free of linting errors.
5254

53-
5. On your new branch, bump the version(s) in `package.json` (see [Versioning and Tags](https://github.com/slackapi/node-slack-sdk/blob/main/.github/maintainers_guide.md#-versioning-and-tags))
55+
5. Generate the reference docs for that package by running `npm run docs`.
56+
57+
6. On your new branch, bump the version(s) in `package.json` (see [Versioning and Tags](https://github.com/slackapi/node-slack-sdk/blob/main/.github/maintainers_guide.md#-versioning-and-tags))
5458

5559
- Make a single commit for the version(s) bump, following the format in: ([Example](https://github.com/slackapi/node-slack-sdk/commit/1503609d79abf035e9e21bad7360e124e4211594))
5660

5761
- Create a pull request for the version change ([Example](https://github.com/slackapi/node-slack-sdk/pull/1059))
5862

5963
- Add appropriate labels on the PR, including `release`
6064

61-
6. Once the PR has been approved and tests have passed, merge it into the main repository.
65+
7. Once the PR has been approved and tests have passed, merge it into the main repository.
6266

6367
- Check out your local `main` branch and update it to get the latest changes: `git checkout main && git pull origin main`
6468

6569
- Add a version tag (ie, `git tag @slack/[email protected]`)
6670

6771
- Push the new tag up to origin: `git push --tags origin`
6872

69-
7. Publish the release to npm
73+
8. Publish the release to npm
7074
- To publish, you need to be a member of the `slack Org` on npm and set up 2-Factor Auth with your passsword generator of choice. Before you can publish with npm, you must run `npm login` from the command line.
7175

7276
- As the final validation, within the package directory (ex: `packages/types`), run `mv package-lock.json package-lock.json.bk && rm -rf node_modules/ dist/ && npm i && npm test && npm pack` and confirm if there are `*.js`, `*.d.ts` files under the `dist` directory.
7377

7478
- Run `npm publish . --otp YOUR_OTP_CODE`. To generate an OTP (One Time Password), use your password generator of choice (Duo, 1Password)
7579

76-
8. Close GitHub Milestone(s)
80+
9. Close GitHub Milestone(s)
7781

7882
- Close the relevant GitHub Milestone(s) for the release(s)
7983

8084
- Check the existing GitHub Milestones to see if the next minor version exists. If it doesn't, then create a GitHub Milestone for new issues to live in. Typically, you'll create a new minor version - however, if there are any bugs that need to be carried over from the current GitHub Milestone, you could make a Milestone for a patch version to reflect those issues
8185

8286
- Move any unfinished, open issues to the next GitHub Milestone
8387

84-
9. Create GitHub Release(s) with release notes
88+
10. Create GitHub Release(s) with release notes
8589

8690
- From the repository, navigate to the **Releases** section and draft a new release
8791

@@ -93,7 +97,7 @@ Releasing can feel intimidating at first, but rest assured: if you make a mistak
9397

9498
- Once the release notes are ready, click the "Publish Release" button to make them public
9599

96-
10. Communicate the release (as appropriate)
100+
11. Communicate the release (as appropriate)
97101

98102
- **Internal**
99103

docs/docusaurus.config.js

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const config = {
4444

4545
plugins: [
4646
'docusaurus-theme-github-codeblock',
47-
4847
[
4948
'@docusaurus/plugin-client-redirects',
5049
{
@@ -53,107 +52,13 @@ const config = {
5352
to: '/getting-started#getting-a-token-to-use-the-web-api',
5453
from: ['/auth'],
5554
},
56-
{
57-
to: '/reference/logger',
58-
from: ['/reference'],
59-
},
6055
{
6156
to: 'https://github.com/SlackAPI/node-slack-sdk/releases',
6257
from: ['/changelog'],
6358
},
6459
],
6560
},
6661
],
67-
[
68-
'docusaurus-plugin-typedoc',
69-
{
70-
id: 'cli-test',
71-
entryPoints: ['../packages/cli-test/src/index.ts'],
72-
tsconfig: '../packages/cli-test/tsconfig.json',
73-
out: './content/reference/cli-test',
74-
},
75-
],
76-
[
77-
'docusaurus-plugin-typedoc',
78-
{
79-
id: 'events-api',
80-
entryPoints: ['../packages/events-api/src/index.ts'],
81-
tsconfig: '../packages/events-api/tsconfig.json',
82-
out: './content/reference/events-api',
83-
},
84-
],
85-
[
86-
'docusaurus-plugin-typedoc',
87-
{
88-
id: 'interactive-messages',
89-
entryPoints: ['../packages/interactive-messages/src/index.ts'],
90-
tsconfig: '../packages/interactive-messages/tsconfig.json',
91-
out: './content/reference/interactive-messages',
92-
},
93-
],
94-
[
95-
'docusaurus-plugin-typedoc',
96-
{
97-
id: 'logger',
98-
entryPoints: ['../packages/logger/src/index.ts'],
99-
tsconfig: '../packages/logger/tsconfig.json',
100-
out: './content/reference/logger',
101-
},
102-
],
103-
[
104-
'docusaurus-plugin-typedoc',
105-
{
106-
id: 'oauth',
107-
entryPoints: ['../packages/oauth/src/index.ts'],
108-
tsconfig: '../packages/oauth/tsconfig.json',
109-
out: './content/reference/oauth',
110-
},
111-
],
112-
[
113-
'docusaurus-plugin-typedoc',
114-
{
115-
id: 'rtm-api',
116-
entryPoints: ['../packages/rtm-api/src/index.ts'],
117-
tsconfig: '../packages/rtm-api/tsconfig.json',
118-
out: './content/reference/rtm-api',
119-
},
120-
],
121-
[
122-
'docusaurus-plugin-typedoc',
123-
{
124-
id: 'socket-mode',
125-
entryPoints: ['../packages/socket-mode/src/index.ts'],
126-
tsconfig: '../packages/socket-mode/tsconfig.json',
127-
out: './content/reference/socket-mode',
128-
},
129-
],
130-
[
131-
'docusaurus-plugin-typedoc',
132-
{
133-
id: 'types',
134-
entryPoints: ['../packages/types/src/index.ts'],
135-
tsconfig: '../packages/types/tsconfig.json',
136-
out: './content/reference/types',
137-
},
138-
],
139-
[
140-
'docusaurus-plugin-typedoc',
141-
{
142-
id: 'web',
143-
entryPoints: ['../packages/web-api/src/index.ts'],
144-
tsconfig: '../packages/web-api/tsconfig.json',
145-
out: './content/reference/web-api',
146-
},
147-
],
148-
[
149-
'docusaurus-plugin-typedoc',
150-
{
151-
id: 'webhook',
152-
entryPoints: ['../packages/webhook/src/index.ts'],
153-
tsconfig: '../packages/webhook/tsconfig.json',
154-
out: './content/reference/webhook',
155-
},
156-
],
15762
],
15863

15964
themeConfig:

docs/sidebars.js

Lines changed: 9 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -63,98 +63,16 @@ const sidebars = {
6363
{
6464
type: 'category',
6565
label: 'Reference',
66+
link: {
67+
type: 'generated-index',
68+
slug: '/reference',
69+
},
6670
items: [
67-
{
68-
type: 'category',
69-
label: '@slack/cli-test',
70-
link: {
71-
type: 'doc',
72-
id: 'reference/cli-test/index',
73-
},
74-
items: require('./content/reference/cli-test/typedoc-sidebar.cjs'),
75-
},
76-
{
77-
type: 'category',
78-
label: '@slack/events-api',
79-
link: {
80-
type: 'doc',
81-
id: 'reference/events-api/index',
82-
},
83-
items: require('./content/reference/events-api/typedoc-sidebar.cjs'),
84-
},
85-
{
86-
type: 'category',
87-
label: '@slack/interactive-messages',
88-
link: {
89-
type: 'doc',
90-
id: 'reference/interactive-messages/index',
91-
},
92-
items: require('./content/reference/interactive-messages/typedoc-sidebar.cjs'),
93-
},
94-
{
95-
type: 'category',
96-
label: '@slack/logger',
97-
link: {
98-
type: 'doc',
99-
id: 'reference/logger/index',
100-
},
101-
items: require('./content/reference/logger/typedoc-sidebar.cjs'),
102-
},
103-
{
104-
type: 'category',
105-
label: '@slack/oauth',
106-
link: {
107-
type: 'doc',
108-
id: 'reference/oauth/index',
109-
},
110-
items: require('./content/reference/oauth/typedoc-sidebar.cjs'),
111-
},
112-
{
113-
type: 'category',
114-
label: '@slack/rtm-api',
115-
link: {
116-
type: 'doc',
117-
id: 'reference/rtm-api/index',
118-
},
119-
items: require('./content/reference/rtm-api/typedoc-sidebar.cjs'),
120-
},
121-
{
122-
type: 'category',
123-
label: '@slack/socket-mode',
124-
link: {
125-
type: 'doc',
126-
id: 'reference/socket-mode/index',
127-
},
128-
items: require('./content/reference/socket-mode/typedoc-sidebar.cjs'),
129-
},
130-
{
131-
type: 'category',
132-
label: '@slack/types',
133-
link: {
134-
type: 'doc',
135-
id: 'reference/types/index',
136-
},
137-
items: require('./content/reference/types/typedoc-sidebar.cjs'),
138-
},
139-
{
140-
type: 'category',
141-
label: '@slack/web-api',
142-
link: {
143-
type: 'doc',
144-
id: 'reference/web-api/index',
145-
},
146-
items: require('./content/reference/web-api/typedoc-sidebar.cjs'),
147-
},
148-
{
149-
type: 'category',
150-
label: '@slack/webhook',
151-
link: {
152-
type: 'doc',
153-
id: 'reference/webhook/index',
154-
},
155-
items: require('./content/reference/webhook/typedoc-sidebar.cjs'),
156-
},
157-
],
71+
{
72+
type: 'autogenerated',
73+
dirName: 'reference',
74+
},
75+
]
15876
},
15977
{type: 'html', value: '<hr>'},
16078
'support-schedule',

docs/typedoc.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/cli-test/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"scripts": {
2828
"build": "npm run build:clean && tsc",
2929
"build:clean": "shx rm -rf ./dist ./coverage",
30+
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
3031
"lint": "npx @biomejs/biome check .",
3132
"lint:fix": "npx @biomejs/biome check --write .",
3233
"prepare": "npm run build",
@@ -53,6 +54,8 @@
5354
"shx": "^0.4.0",
5455
"sinon": "^21.0.0",
5556
"ts-node": "^10.9.2",
57+
"typedoc": "^0.28.7",
58+
"typedoc-plugin-markdown": "^4.7.1",
5659
"typescript": "5.8.3"
5760
}
5861
}

packages/cli-test/typedoc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"entryPoints": ["src/index.ts"],
4+
"plugin": ["typedoc-plugin-markdown"],
5+
"outputs": [
6+
{
7+
"name": "markdown",
8+
"path": "../../docs/content/reference/cli-test"
9+
}
10+
],
11+
"skipErrorChecking": true,
12+
"useCodeBlocks": true,
13+
"logLevel": "Error",
14+
"readme": "none",
15+
"gitRevision": "main",
16+
"includeVersion": true,
17+
"excludePrivate": true,
18+
"excludeProtected": true,
19+
"excludeInternal": true,
20+
"hideGenerator": true,
21+
"jsDocCompatibility": true,
22+
"hidePageHeader": true,
23+
"entryFileName": "index",
24+
"exclude": ["**/*.test.ts", "**/*.spec.ts", "**/*.test-d.ts"]
25+
}

packages/logger/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"prepare": "npm run build",
3030
"build": "npm run build:clean && tsc",
3131
"build:clean": "shx rm -rf ./dist ./coverage",
32+
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
3233
"lint": "npx @biomejs/biome check .",
3334
"lint:fix": "npx @biomejs/biome check --write .",
3435
"mocha": "mocha --config ./test/.mocharc.json src/*.spec.js",
@@ -52,6 +53,8 @@
5253
"sinon": "^21.0.0",
5354
"source-map-support": "^0.5.21",
5455
"ts-node": "^10.9.2",
56+
"typedoc": "^0.28.7",
57+
"typedoc-plugin-markdown": "^4.7.1",
5558
"typescript": "^5.5.4"
5659
}
5760
}

packages/logger/typedoc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"entryPoints": ["src/index.ts"],
4+
"plugin": ["typedoc-plugin-markdown"],
5+
"outputs": [
6+
{
7+
"name": "markdown",
8+
"path": "../../docs/content/reference/logger"
9+
}
10+
],
11+
"skipErrorChecking": true,
12+
"useCodeBlocks": true,
13+
"logLevel": "Error",
14+
"readme": "none",
15+
"gitRevision": "main",
16+
"includeVersion": true,
17+
"excludePrivate": true,
18+
"excludeProtected": true,
19+
"excludeInternal": true,
20+
"hideGenerator": true,
21+
"jsDocCompatibility": true,
22+
"hidePageHeader": true,
23+
"entryFileName": "index",
24+
"exclude": ["**/*.test.ts", "**/*.spec.ts", "**/*.test-d.ts"]
25+
}

0 commit comments

Comments
 (0)