-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathapi-reference.ts
More file actions
44 lines (39 loc) · 1.37 KB
/
api-reference.ts
File metadata and controls
44 lines (39 loc) · 1.37 KB
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
import path from 'node:path'
import { globSync } from 'glob'
import { fixLinks, processTemplate } from './typedoc/template-processor'
import { generateTypeDoc, type PartialConfig } from './typedoc/typedoc-runner'
const packages = [
'@expressive-code/core',
'@expressive-code/plugin-frames',
'@expressive-code/plugin-line-numbers',
'@expressive-code/plugin-shiki',
'@expressive-code/plugin-text-markers',
'@expressive-code/plugin-collapsible-sections',
'expressive-code',
'rehype-expressive-code',
'astro-expressive-code',
]
const sourceFiles: PartialConfig = {
basePath: '../packages',
entryPoints: packages.map((packageName) => `../packages/${packageName}/src/index.ts`),
exclude: ['**/coverage/**/*', '**/node_modules/**/*', '**/dist/**/*', '**/test/**/*'],
skipErrorChecking: true,
tsconfig: '../tsconfig.base.json',
useTsLinkResolution: true,
}
const { outputPath } = await generateTypeDoc(sourceFiles)
// Process all templates
const templateDir = './scripts/typedoc/templates'
const docsDir = './src/content/docs'
const templateFileSubpaths = globSync(`**/*.mdx`, {
cwd: templateDir,
posix: true,
})
templateFileSubpaths.forEach((templateFileSubpath) => {
processTemplate({
apiDocsPath: outputPath,
templateFilePath: path.join(templateDir, templateFileSubpath),
outputFilePath: path.join(docsDir, templateFileSubpath),
})
})
fixLinks(docsDir, templateFileSubpaths)