forked from paraswap/paraswap-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
typedoc.js
48 lines (44 loc) · 1.17 KB
/
typedoc.js
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
const MD = process.env.MD === 'true';
const mode = MD ? 'md' : 'html';
const other_mode = !MD ? 'md' : 'html';
const commonPlugins = [
'typedoc-plugin-missing-exports',
'typedoc-plugin-replace-text',
];
const extraReplacements = MD
? [
{
// all docs/md/* -> * in README.md
// to account for README copy in docs/md
pattern: 'docs/md/',
flags: 'g',
replace: '',
},
]
: [];
module.exports = {
entryPoints: ['src/index.ts'],
out: `docs/${mode}`,
plugin: MD ? ['typedoc-plugin-markdown', ...commonPlugins] : commonPlugins,
// typedoc-plugin-replace-text options
replaceText: {
inCodeCommentText: false,
inCodeCommentTags: false,
inIncludedFiles: true,
replacements: [
{
// remove texts between comments
pattern: `\\[comment\\]: # \\(<remove_for:${mode}>\\).*?\\[comment\\]: # \\(</remove_for:${mode}>\\)`,
flags: 'gms',
replace: '',
},
{
// remove comments pertaining to the other mode
pattern: `\\[comment\\]: # \\(</?remove_for:${other_mode}>\\)`,
flags: 'g',
replace: '',
},
...extraReplacements,
],
},
};