ac1354da9e
mirror-to-gitee / mirror (push) Successful in 5s
排版语言 - 引入独立视觉系统 .vitepress/theme/styles/portal.css: 中性底色 + 单一强调色(#4f46e5),正文靠留白与层级取胜, 不使用大面积彩色底、渐变铺满或装饰性图形 - CSS 变量定义在 :root(原先挂在 .portal 下,导致内容页拿不到值) - 完整支持暗色模式,变量在 html.dark 下整体替换 首页(pages/index.md → HomePage.vue) - hero:居中大标题(强调色渐变仅作用于一个词组)、双按钮、四格数据条 - 项目区:三栏卡片,标题 + 状态徽标 + 定位 + 说明 + 技术栈标签 - 通用能力:六格编号卡片 - 组合方式:三栏场景步骤卡,每张带一条可复制命令 - 底部 CTA 区块 - 页面改用 layout: page,通过 Layout 包装层去掉默认窄栏 项目详情页 - iotLCM / DTU:能力矩阵改为标签切换(CapabilityTabs), 每个业务域一屏,点击切换,替代原先的大宽表 - XiuAdmin:22 项内置功能按用途归为四组标签墙(FeatureGrid) - 内容页二级标题加短强调线,表格首列不换行,属性表不再竖排 数据 - 新增 data/content.ts 承载首页文案、能力分组、长期事实统计, 与 projects.ts 并列;文案口径取自各项目 README/详情页,无凭空数字 - 修正 scripts/check-registry.mjs:原先扫描 data/ 下所有 .ts 的 id, 新增 content.ts 后把业务分组 id 误判为项目;改为只读 projects.ts 验证 - 构建通过,12 个页面,193 条引用 0 失效 - HTTP 实测 12 个路径全 200,不存在路径 404 - 暗色模式与移动端(390px)已截图核对,无横向溢出
48 lines
1.9 KiB
JavaScript
48 lines
1.9 KiB
JavaScript
#!/usr/bin/env node
|
||
/**
|
||
* 校验「项目注册表」与「详情页目录」是否一一对应。
|
||
*
|
||
* 门户的项目清单由 data/projects.ts 单一驱动。如果注册表加了项目却忘了写详情页,
|
||
* 或者写了详情页却没登记进注册表,首页卡片与侧边栏就会和实际内容脱节。
|
||
* 这个脚本在 dev / build 之前自动跑,不一致直接退出非零。
|
||
*/
|
||
import { readdirSync, readFileSync, existsSync } from 'node:fs'
|
||
import { fileURLToPath } from 'node:url'
|
||
import { dirname, join } from 'node:path'
|
||
|
||
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
|
||
const dataDir = join(root, 'data')
|
||
const pagesDir = join(root, 'pages', 'projects')
|
||
|
||
// 注册表是 TS 源文件,这里只需要 id 列表,正则抽取即可,不引入编译步骤。
|
||
// 只看 projects.ts:data/ 下其它文件(如首页文案 content.ts)里的 id 不是项目 id。
|
||
const registrySrc = readFileSync(join(dataDir, 'projects.ts'), 'utf-8')
|
||
|
||
const registered = [...registrySrc.matchAll(/\bid:\s*'([^']+)'/g)].map((m) => m[1])
|
||
|
||
if (registered.length === 0) {
|
||
console.error('[check] 注册表里没解析到任何项目,检查 data/projects.ts 的格式')
|
||
process.exit(1)
|
||
}
|
||
|
||
const onDisk = existsSync(pagesDir)
|
||
? readdirSync(pagesDir, { withFileTypes: true })
|
||
.filter((d) => d.isDirectory())
|
||
.map((d) => d.name)
|
||
: []
|
||
|
||
const missingPages = registered.filter((id) => !onDisk.includes(id))
|
||
const missingEntries = onDisk.filter((id) => !registered.includes(id))
|
||
|
||
if (missingPages.length || missingEntries.length) {
|
||
if (missingPages.length) {
|
||
console.error(`[check] 注册表里有项目但缺详情页:${missingPages.join(', ')}`)
|
||
}
|
||
if (missingEntries.length) {
|
||
console.error(`[check] 有详情页但没登记进注册表:${missingEntries.join(', ')}`)
|
||
}
|
||
process.exit(1)
|
||
}
|
||
|
||
console.log(`[check] OK:注册表 ${registered.length} 个项目与详情页一一对应(${registered.join(', ')})`)
|