-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
typedoc.mjs
32 lines (31 loc) · 1.05 KB
/
typedoc.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
import { execSync } from 'node:child_process'
import { copyFileSync, mkdirSync, readdirSync, rmSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
try {
mkdirSync(join(dirname(fileURLToPath(import.meta.url)), 'tmp'), {
recursive: true,
})
const markdownFiles = readdirSync(
join(dirname(fileURLToPath(import.meta.url)), 'docs')
).filter(file => file.endsWith('.md'))
for (const markdownFile of markdownFiles) {
copyFileSync(
join(dirname(fileURLToPath(import.meta.url)), 'docs', markdownFile),
join(dirname(fileURLToPath(import.meta.url)), 'tmp', markdownFile)
)
}
execSync('npx typedoc', { stdio: 'inherit' })
for (const markdownFile of markdownFiles) {
copyFileSync(
join(dirname(fileURLToPath(import.meta.url)), 'tmp', markdownFile),
join(dirname(fileURLToPath(import.meta.url)), 'docs', markdownFile)
)
}
rmSync(join(dirname(fileURLToPath(import.meta.url)), 'tmp'), {
recursive: true,
force: true,
})
} catch (e) {
console.error(e)
}