feat: 1.统一右侧抽屉关闭按钮布局 2.统一 UI 组件为 Ant Design 移除 radix-ui、floating-ui 组件 3. 修复 ESLint 文件格式错误的问题

This commit is contained in:
zhanjunhao
2026-11-10 14:08:10 +08:00
parent 5c0849e82b
commit 85214b308a
202 changed files with 29195 additions and 12732 deletions
+22 -6
View File
@@ -10,7 +10,8 @@ const SRC_DIR = path.join(__dirname, '..', 'src');
const LANGS = require('./i18n_langs.cjs');
const load = (n) =>
JSON.parse(fs.readFileSync(path.join(LOCALES_DIR, `${n}.json`), 'utf8')).translation;
JSON.parse(fs.readFileSync(path.join(LOCALES_DIR, `${n}.json`), 'utf8'))
.translation;
const T_CALL_RE = /\bt\(\s*(['"`])((?:\\.|(?!\1).)*?)\1/g;
const CJK_RE = /[一-鿿]/;
@@ -19,7 +20,11 @@ function walk(dir, files = []) {
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) {
if (['node_modules', 'dist'].includes(entry.name) || entry.name.startsWith('.')) continue;
if (
['node_modules', 'dist'].includes(entry.name) ||
entry.name.startsWith('.')
)
continue;
walk(full, files);
} else if (/\.(jsx?|tsx?)$/.test(entry.name)) {
files.push(full);
@@ -38,7 +43,9 @@ function unescape(raw) {
const dicts = Object.fromEntries(LANGS.map((l) => [l, load(l)]));
const primary = dicts[LANGS[0]];
const files = walk(SRC_DIR).filter((f) => !f.includes(path.join('src', 'i18n')));
const files = walk(SRC_DIR).filter(
(f) => !f.includes(path.join('src', 'i18n')),
);
const byArea = new Map();
const allUsed = new Set();
@@ -49,7 +56,9 @@ for (const file of files) {
// 粒度必须与 i18n_kt_batches.cjs 的分层一致:components 也要拆到子目录,
// 否则 2800 多个 key 全折叠成一个 'components',看不出各子区域是否打满。
const area =
rel[0] === 'pages' || rel[0] === 'components' ? `${rel[0]}/${rel[1]}` : rel[0];
rel[0] === 'pages' || rel[0] === 'components'
? `${rel[0]}/${rel[1]}`
: rel[0];
let m;
T_CALL_RE.lastIndex = 0;
while ((m = T_CALL_RE.exec(content)) !== null) {
@@ -68,13 +77,20 @@ for (const l of LANGS) {
console.log(` ${l} 已译:${d} (${Math.round((d / used.length) * 100)}%)`);
}
const absent = used.filter((k) => !(k in primary)).length;
console.log(` 不在 ${LANGS[0]}.json 中(en.json 也缺,运行时回退中文):${absent}`);
console.log(
` 不在 ${LANGS[0]}.json 中(en.json 也缺,运行时回退中文):${absent}`,
);
const stats = [...byArea.entries()]
.map(([area, set]) => {
const arr = [...set];
const done = arr.filter((k) => primary[k]).length;
return { area, total: arr.length, done, pct: Math.round((done / arr.length) * 100) };
return {
area,
total: arr.length,
done,
pct: Math.round((done / arr.length) * 100),
};
})
.filter((r) => r.total >= 25)
.sort((a, b) => a.pct - b.pct);