Skip to content

Commit a42da11

Browse files
committed
ci(docs): generate api-whitelist before config load
- Add prebuild script to generate api-whitelist before vite loads - Add mkdir to ensure build/generated/ directory exists - Add tsx as devDependency for prebuild script
1 parent 3fd9bc7 commit a42da11

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

apps/docs/build/generate-api-whitelist.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Or automatically via the Vite plugin in vite.config.ts
1010
*/
1111

12-
import { readdir, readFile, writeFile } from 'node:fs/promises'
12+
import { mkdir, readdir, readFile, writeFile } from 'node:fs/promises'
1313
import { dirname, resolve } from 'node:path'
1414
import { fileURLToPath } from 'node:url'
1515

@@ -155,6 +155,7 @@ ${toDirEntries.map(([fn, dir]) => ` '${fn}': '${dir}',`).join('\n')}
155155
return // No changes, skip write to prevent restart loop
156156
}
157157

158+
await mkdir(dirname(OUTPUT_FILE), { recursive: true })
158159
await writeFile(OUTPUT_FILE, content)
159160
console.log(`[generate-api-whitelist] Generated ${OUTPUT_FILE}`)
160161
console.log(` Components: ${components.length}`)

apps/docs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite --port 8000",
8+
"prebuild": "tsx build/generate-api-whitelist.ts",
89
"build": "vite-ssg build",
910
"preview": "vite preview"
1011
},
@@ -19,6 +20,7 @@
1920
"markdown-it-attrs": "catalog:",
2021
"shiki": "catalog:",
2122
"ts-morph": "catalog:",
23+
"tsx": "catalog:",
2224
"unocss": "catalog:",
2325
"unplugin-vue": "catalog:",
2426
"unplugin-vue-components": "catalog:",

0 commit comments

Comments
 (0)