Skip to content

Commit 225b38c

Browse files
authored
chore(repo): Use markdown plugin for typedoc (#5099)
1 parent 26d273c commit 225b38c

File tree

7 files changed

+43
-162
lines changed

7 files changed

+43
-162
lines changed

.changeset/late-bags-hang.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/shared': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Small JSDoc and type improvements

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
"turbo": "^2.0.14",
129129
"turbo-ignore": "^2.0.6",
130130
"typedoc": "0.27.6",
131-
"typedoc-plugin-missing-exports": "3.1.0",
131+
"typedoc-plugin-markdown": "4.4.1",
132132
"typescript": "catalog:repo",
133133
"typescript-eslint": "8.21.0",
134134
"uuid": "8.3.2",

packages/shared/src/telemetry/throttler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class TelemetryEventThrottler {
4848
#generateKey(event: TelemetryEvent): string {
4949
const { sk: _sk, pk: _pk, payload, ...rest } = event;
5050

51-
const sanitizedEvent = {
51+
const sanitizedEvent: Omit<TelemetryEvent, 'sk' | 'pk' | 'payload'> & TelemetryEvent['payload'] = {
5252
...payload,
5353
...rest,
5454
};

packages/shared/typedoc.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"entryPoints": ["./src/index.ts", "./src/react/index.ts"],
4+
"compilerOptions": {
5+
"noImplicitAny": false
6+
}
7+
}

packages/types/src/hooks.ts

+6-150
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type CheckAuthorizationWithoutOrgOrUser = (params: Parameters<CheckAuthorization
1717

1818
/**
1919
* Return values of the `useAuth()` hook
20+
* @interface
2021
*/
2122
export type UseAuthReturn =
2223
| {
@@ -63,137 +64,48 @@ export type UseAuthReturn =
6364
getToken: GetToken;
6465
}
6566
| {
66-
/**
67-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
68-
*/
6967
isLoaded: true;
70-
/**
71-
* A boolean that indicates whether a user is currently signed in.
72-
*/
7368
isSignedIn: false;
74-
/**
75-
* The ID of the current user.
76-
*/
7769
userId: null;
78-
/**
79-
* The ID for the current session.
80-
*/
8170
sessionId: null;
8271
actor: null;
83-
/**
84-
* The ID of the user's active organization.
85-
*/
8672
orgId: null;
87-
/**
88-
* The current user's role in their active organization.
89-
*/
9073
orgRole: null;
91-
/**
92-
* The URL-friendly identifier of the user's active organization.
93-
*/
9474
orgSlug: null;
95-
/**
96-
* A function that checks if the user has specific permissions or roles. See the [reference doc](https://clerk.com/docs/references/backend/types/auth-object#has).
97-
*/
9875
has: CheckAuthorizationWithoutOrgOrUser;
99-
/**
100-
* A function that signs out the current user. Returns a promise that resolves when complete. See the [reference doc](https://clerk.com/docs/references/javascript/clerk/clerk#sign-out).
101-
*/
10276
signOut: SignOut;
103-
/**
104-
* A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
105-
*/
10677
getToken: GetToken;
10778
}
10879
| {
109-
/**
110-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
111-
*/
11280
isLoaded: true;
113-
/**
114-
* A boolean that indicates whether a user is currently signed in.
115-
*/
11681
isSignedIn: true;
117-
/**
118-
* The ID of the current user.
119-
*/
12082
userId: string;
121-
/**
122-
* The ID for the current session.
123-
*/
12483
sessionId: string;
12584
actor: ActJWTClaim | null;
126-
/**
127-
* The ID of the user's active organization.
128-
*/
12985
orgId: null;
130-
/**
131-
* The current user's role in their active organization.
132-
*/
13386
orgRole: null;
134-
/**
135-
* The URL-friendly identifier of the user's active organization.
136-
*/
13787
orgSlug: null;
138-
/**
139-
* A function that checks if the user has specific permissions or roles. See the [reference doc](https://clerk.com/docs/references/backend/types/auth-object#has).
140-
*/
14188
has: CheckAuthorizationWithCustomPermissions;
142-
/**
143-
* A function that signs out the current user. Returns a promise that resolves when complete. See the [reference doc](https://clerk.com/docs/references/javascript/clerk/clerk#sign-out).
144-
*/
14589
signOut: SignOut;
146-
/**
147-
* A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
148-
*/
14990
getToken: GetToken;
15091
}
15192
| {
152-
/**
153-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
154-
*/
15593
isLoaded: true;
156-
/**
157-
* A boolean that indicates whether a user is currently signed in.
158-
*/
15994
isSignedIn: true;
160-
/**
161-
* The ID of the current user.
162-
*/
16395
userId: string;
164-
/**
165-
* The ID for the current session.
166-
*/
16796
sessionId: string;
16897
actor: ActJWTClaim | null;
169-
/**
170-
* The ID of the user's active organization.
171-
*/
17298
orgId: string;
173-
/**
174-
* The current user's role in their active organization.
175-
*/
17699
orgRole: OrganizationCustomRoleKey;
177-
/**
178-
* The URL-friendly identifier of the user's active organization.
179-
*/
180100
orgSlug: string | null;
181-
/**
182-
* A function that checks if the user has specific permissions or roles. See the [reference doc](https://clerk.com/docs/references/backend/types/auth-object#has).
183-
*/
184101
has: CheckAuthorizationWithCustomPermissions;
185-
/**
186-
* A function that signs out the current user. Returns a promise that resolves when complete. See the [reference doc](https://clerk.com/docs/references/javascript/clerk/clerk#sign-out).
187-
*/
188102
signOut: SignOut;
189-
/**
190-
* A function that retrieves the current user's session token or a custom JWT template. Returns a promise that resolves to the token. See the [reference doc](https://clerk.com/docs/references/javascript/session#get-token).
191-
*/
192103
getToken: GetToken;
193104
};
194105

195106
/**
196107
* Return values of the `useSignIn()` hook
108+
* @interface
197109
*/
198110
export type UseSignInReturn =
199111
| {
@@ -211,22 +123,14 @@ export type UseSignInReturn =
211123
setActive: undefined;
212124
}
213125
| {
214-
/**
215-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
216-
*/
217126
isLoaded: true;
218-
/**
219-
* An object that contains the current sign-in attempt status and methods to create a new sign-in attempt.
220-
*/
221127
signIn: SignInResource;
222-
/**
223-
* A function that sets the active session.
224-
*/
225128
setActive: SetActive;
226129
};
227130

228131
/**
229132
* Return values of the `useSignUp()` hook
133+
* @interface
230134
*/
231135
export type UseSignUpReturn =
232136
| {
@@ -244,22 +148,14 @@ export type UseSignUpReturn =
244148
setActive: undefined;
245149
}
246150
| {
247-
/**
248-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
249-
*/
250151
isLoaded: true;
251-
/**
252-
* An object that contains the current sign-up attempt status and methods to create a new sign-up attempt.
253-
*/
254152
signUp: SignUpResource;
255-
/**
256-
* A function that sets the active session.
257-
*/
258153
setActive: SetActive;
259154
};
260155

261156
/**
262157
* Return values of the `useSession()` hook
158+
* @interface
263159
*/
264160
export type UseSessionReturn =
265161
| {
@@ -277,36 +173,19 @@ export type UseSessionReturn =
277173
session: undefined;
278174
}
279175
| {
280-
/**
281-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
282-
*/
283176
isLoaded: true;
284-
/**
285-
* A boolean that indicates whether a user is currently signed in.
286-
*/
287177
isSignedIn: false;
288-
/**
289-
* Holds the current active session for the user.
290-
*/
291178
session: null;
292179
}
293180
| {
294-
/**
295-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
296-
*/
297181
isLoaded: true;
298-
/**
299-
* A boolean that indicates whether a user is currently signed in.
300-
*/
301182
isSignedIn: true;
302-
/**
303-
* Holds the current active session for the user.
304-
*/
305183
session: ActiveSessionResource;
306184
};
307185

308186
/**
309187
* Return values of the `useSessionList()` hook
188+
* @interface
310189
*/
311190
export type UseSessionListReturn =
312191
| {
@@ -324,22 +203,14 @@ export type UseSessionListReturn =
324203
setActive: undefined;
325204
}
326205
| {
327-
/**
328-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
329-
*/
330206
isLoaded: true;
331-
/**
332-
* A list of sessions that have been registered on the client device.
333-
*/
334207
sessions: SessionResource[];
335-
/**
336-
* A function that sets the active session and/or organization.
337-
*/
338208
setActive: SetActive;
339209
};
340210

341211
/**
342212
* Return values of the `useUser()` hook
213+
* @interface
343214
*/
344215
export type UseUserReturn =
345216
| {
@@ -358,26 +229,11 @@ export type UseUserReturn =
358229
}
359230
| {
360231
isLoaded: true;
361-
/**
362-
* A boolean that indicates whether a user is currently signed in.
363-
*/
364232
isSignedIn: false;
365-
/**
366-
* The `User` object for the current user. If the user isn't signed in, `user` will be `null`.
367-
*/
368233
user: null;
369234
}
370235
| {
371-
/**
372-
* A boolean that indicates whether Clerk has completed initialization. Initially `false`, becomes `true` once Clerk loads.
373-
*/
374236
isLoaded: true;
375-
/**
376-
* A boolean that indicates whether a user is currently signed in.
377-
*/
378237
isSignedIn: true;
379-
/**
380-
* The `User` object for the current user. If the user isn't signed in, `user` will be `null`.
381-
*/
382238
user: UserResource;
383239
};

pnpm-lock.yaml

+8-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

typedoc.config.mjs

+14-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,20 @@ function getPackages() {
2323
return packages.filter(dir => !IGNORE_LIST.includes(dir)).map(dir => path.join('packages', dir));
2424
}
2525

26+
/** @type {import("typedoc-plugin-markdown").PluginOptions} */
27+
const typedocPluginMarkdownOptions = {
28+
hidePageHeader: true,
29+
hideBreadcrumbs: true,
30+
hidePageTitle: true,
31+
};
32+
2633
/** @type {Partial<import("typedoc").TypeDocOptions>} */
2734
const config = {
2835
out: './.typedoc/docs',
2936
// TODO: Once we're happy with the output the JSON should be written to a non-gitignored location as we want to consume it in other places
3037
json: './.typedoc/output.json',
3138
entryPointStrategy: 'packages',
32-
plugin: ['typedoc-plugin-missing-exports'],
39+
plugin: ['typedoc-plugin-markdown'],
3340
packageOptions: {
3441
includeVersion: false,
3542
excludePrivate: true,
@@ -39,11 +46,15 @@ const config = {
3946
excludeInternal: true,
4047
excludeNotDocumented: true,
4148
gitRevision: 'main',
42-
blockTags: [...OptionDefaults.blockTags, '@warning', '@note', '@important'],
49+
blockTags: [...OptionDefaults.blockTags, '@warning', '@note', '@important', '@memberof'],
4350
modifierTags: [...OptionDefaults.modifierTags],
4451
exclude: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
52+
readme: 'none',
53+
disableGit: true,
54+
disableSources: true,
4555
},
46-
entryPoints: ['packages/nextjs', 'packages/react', 'packages/backend', 'packages/types'], // getPackages(),
56+
entryPoints: ['packages/nextjs', 'packages/react', 'packages/shared', 'packages/types'], // getPackages(),
57+
...typedocPluginMarkdownOptions,
4758
};
4859

4960
export default config;

0 commit comments

Comments
 (0)