- 从 collections、导航移除 LeetCode,删除 docs/notes/programming/leetcode 下页面 - devDependencies 显式加入 @vuepress/helper@rc.123,配合 overrides 降低 Vite 预构建白屏风险 - 新增 npm run docs:verify 与 scripts/verify-site.mjs(构建后检查首页 hero) - .cursor/rules/agent-workflow-verify-and-git.mdc:每次修改须验证;用户未明确说不要提交时默认 commit Made-with: Cursor
28 lines
921 B
JavaScript
28 lines
921 B
JavaScript
import { readFileSync, existsSync } from 'node:fs'
|
|
import { spawnSync } from 'node:child_process'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { dirname, join } from 'node:path'
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
|
const indexHtml = join(root, 'docs', '.vuepress', 'dist', 'index.html')
|
|
|
|
const build = spawnSync('npm', ['run', 'docs:build'], {
|
|
cwd: root,
|
|
shell: true,
|
|
stdio: 'inherit',
|
|
})
|
|
if (build.status !== 0) process.exit(build.status ?? 1)
|
|
|
|
if (!existsSync(indexHtml)) {
|
|
console.error('verify-site: dist/index.html missing after build')
|
|
process.exit(1)
|
|
}
|
|
|
|
const html = readFileSync(indexHtml, 'utf8')
|
|
if (!html.includes('hero-name') || !html.includes('仲夏夜之梦')) {
|
|
console.error('verify-site: home hero markers missing in dist/index.html (possible theme/render failure)')
|
|
process.exit(1)
|
|
}
|
|
|
|
console.log('verify-site: OK (home hero present in production build)')
|