-
Notifications
You must be signed in to change notification settings - Fork 326
/
Copy pathtypedoc.config.mjs
96 lines (89 loc) · 2.89 KB
/
typedoc.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import path from 'node:path';
import fs from 'node:fs';
import { OptionDefaults } from 'typedoc';
const IGNORE_LIST = ['.DS_Store', 'dev-cli', 'expo-passkeys', 'testing', 'themes', 'upgrade'];
/**
* Return an array of relative paths to all folders in the "packages" folder to be used for the "entryPoints" option.
*/
function getPackages() {
const packagesDir = path.resolve('packages');
const packages = fs.readdirSync(packagesDir);
return packages.filter(dir => !IGNORE_LIST.includes(dir)).map(dir => path.join('packages', dir));
}
/** @type {import("typedoc-plugin-markdown").PluginOptions} */
const typedocPluginMarkdownOptions = {
hidePageHeader: true,
hideBreadcrumbs: true,
hidePageTitle: true,
parametersFormat: 'table',
interfacePropertiesFormat: 'table',
classPropertiesFormat: 'table',
enumMembersFormat: 'table',
propertyMembersFormat: 'table',
typeDeclarationFormat: 'table',
typeDeclarationVisibility: 'compact',
useHTMLAnchors: false,
tableColumnSettings: {
hideSources: true,
},
fileExtension: '.mdx',
excludeScopesInPaths: true,
expandObjects: true,
};
/** @type {Partial<import("typedoc-plugin-replace-text").Config>} */
const typedocPluginReplaceTextOptions = {
replaceText: {
replacements: [
{
/**
* Inside our JSDoc comments we have absolute links to our docs, e.g. [Foo](https://clerk.com/docs/bar).
* We want to replace these with relative links, e.g. [Foo](/docs/bar).
*/
pattern: /https:\/\/clerk\.com\/docs/,
replace: '/docs',
flags: 'g',
},
{
/**
* Sometimes we need to add ```empty``` to an @example so that it's properly rendered (but we don't want to show a codeblock). This removes these placeholders.
*/
pattern: /```empty```/,
replace: '',
},
],
},
};
/** @type {Partial<import("typedoc").TypeDocOptions>} */
const config = {
out: './.typedoc/docs',
json: './.typedoc/docs.json',
entryPointStrategy: 'packages',
plugin: [
'typedoc-plugin-replace-text',
'typedoc-plugin-markdown',
'./.typedoc/custom-theme.mjs',
'./.typedoc/custom-plugin.mjs',
],
theme: 'clerkTheme',
readme: 'none',
packageOptions: {
includeVersion: false,
excludePrivate: true,
sortEntryPoints: true,
sort: 'alphabetical',
excludeExternals: true,
excludeInternal: true,
excludeNotDocumented: true,
gitRevision: 'main',
blockTags: [...OptionDefaults.blockTags, '@warning', '@note', '@important', '@memberof'],
modifierTags: [...OptionDefaults.modifierTags],
exclude: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
readme: 'none',
disableGit: true,
disableSources: true,
...typedocPluginReplaceTextOptions,
},
entryPoints: ['packages/nextjs', 'packages/react', 'packages/shared', 'packages/types'], // getPackages(),
...typedocPluginMarkdownOptions,
};
export default config;