- boot/ (Java/Maven, JNPF 7.0) — 移除旧的 boot/.git,源码直接纳入仓库
- web/ (Vue 3 + Vite + Ant Design Vue, pnpm)
- docs/, scard/, nax/
- refs/INDEX.md + refs/国标/(其余 refs/* 开源子仓库不纳入)
- 已忽略: connector_data/, jweb/, log/, web/{dist,node_modules,.pnpm}, boot/*/target/, .DS_Store, .idea, .vscode
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
/**
|
|
* 把脚本里 antd 两字按钮字面量改成"插空格版" —— 见 README 必知事实 #1。
|
|
* antd 会给 type="default" 的两字按钮中间插一个空格,但 type="link" / "text" 的不插,
|
|
* 所以最稳妥是同时匹配两种渲染:用「忽略空白」的正则。
|
|
*/
|
|
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
const PAIRS = [
|
|
['新\\s*建', '新 建'],
|
|
['刷\\s*新', '刷 新'],
|
|
['查\\s*询', '查 询'],
|
|
['重\\s*置', '重 置'],
|
|
['保\\s*存', '保 存'],
|
|
['取\\s*消', '取 消']
|
|
]
|
|
|
|
const dir = 'cases'
|
|
let fixCount = 0
|
|
for (const f of fs.readdirSync(dir).filter((n) => n.endsWith('.mjs'))) {
|
|
const fp = path.join(dir, f)
|
|
let s = fs.readFileSync(fp, 'utf8')
|
|
const orig = s
|
|
for (const [pattern, _] of PAIRS) {
|
|
// 把 button:has-text("新建") → button:has-text(/新\s*建/) —— 正则能兼容两种渲染
|
|
s = s.replace(
|
|
new RegExp(`button:has-text\\(\\s*"(${pattern})"\\s*\\)`, 'g'),
|
|
(m, p) => `button:has-text(/${p}/)`
|
|
)
|
|
}
|
|
if (s !== orig) { fs.writeFileSync(fp, s); fixCount++ }
|
|
}
|
|
console.log(`已修 ${fixCount} 个文件`) |