You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
735 B
35 lines
735 B
import fs from "fs";
|
|
|
|
const p = "src/components/MailBusinessSummary.tsx";
|
|
let t = fs.readFileSync(p, "utf8");
|
|
|
|
const btnWo = "\u786e\u8ba4\u63d0\u4ea4\u5de5\u5355";
|
|
|
|
t = t.replace(
|
|
/(mail\.mail_type === "WORK_ORDER"\) \{\s*actions = \(\s*<Button[\s\S]*?>\s*)\?{2,}(\s*<\/Button>)/,
|
|
`$1${btnWo}$2`,
|
|
);
|
|
|
|
// Comments with ? are fine; flag remaining UI ?
|
|
const bad = t
|
|
.split("\n")
|
|
.map((l, i) => ({ i: i + 1, l }))
|
|
.filter(
|
|
(x) =>
|
|
/\?{3,}/.test(x.l) &&
|
|
!x.l.includes("eslint") &&
|
|
!x.l.trim().startsWith("//"),
|
|
);
|
|
|
|
fs.writeFileSync(p, t, "utf8");
|
|
console.log(
|
|
JSON.stringify(
|
|
{
|
|
btnOk: t.includes(btnWo),
|
|
badLines: bad.map((x) => `${x.i}: ${x.l.trim()}`),
|
|
},
|
|
null,
|
|
2,
|
|
),
|
|
);
|