zhangwencui
14 小时以前 ceeeb4f3315fbd4e4ca3e91efffcee0a54bc22ee
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
/**
 * 临时脚本:把真实的积木清单(含 aiHint)导出成 JSON 文件。
 *
 * 存在的理由是「联调时发给后端的清单必须是真货」:手敲一份清单去测,测的是我敲的那份,
 * 而不是前端真正会发出去的那份——hint 有没有真的被 catalog 带出来,只有这条路径能证明。
 * 用法:npx tsx .qc-conformance/dump-catalog.ts <输出路径>
 */
import { writeFileSync } from 'node:fs';
 
import {
  buildQualityComponentCatalog,
  registerAllQualityComponents,
} from '../src/components/quality';
 
registerAllQualityComponents();
 
const target = process.argv[2];
if (!target) {
  throw new Error('用法:npx tsx .qc-conformance/dump-catalog.ts <输出路径>');
}
 
const catalog = buildQualityComponentCatalog();
writeFileSync(target, JSON.stringify(catalog), 'utf8');
 
// eslint-disable-next-line no-console
console.log(`组件 ${catalog.length} 项,带 hint 的 ${catalog.filter((c) => c.hint).length} 项 → ${target}`);