blob: 19c4b4eabf67eb817583b33f429d6a907b62bd5f (
plain)
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
|
import type { DeclarationReflection, ProjectReflection } from 'typedoc';
import { ReflectionKind } from 'typedoc';
import { newTypeDocApp, patchProject } from '../../../scripts/apidoc/utils';
/**
* Loads the example methods using TypeDoc.
*/
export function loadExampleMethods(): Record<string, DeclarationReflection> {
const app = newTypeDocApp();
app.bootstrap({
entryPoints: ['test/scripts/apidoc/signature.example.ts'],
tsconfig: 'test/scripts/apidoc/tsconfig.json',
});
const project = app.convert();
patchProject(project);
const methods: Record<string, DeclarationReflection> = project
.getChildrenByKind(ReflectionKind.Class)[0]
.getChildrenByKind(ReflectionKind.Method)
.reduce((a, v) => ({ ...a, [v.name]: v }), {});
return methods;
}
/**
* Loads the project using TypeDoc.
*/
export function loadProject(): ProjectReflection {
const app = newTypeDocApp();
app.bootstrap({
entryPoints: ['src/index.ts'],
});
const project = app.convert();
patchProject(project);
return project;
}
|