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.
48 lines
1.5 KiB
48 lines
1.5 KiB
import fs from "fs";
|
|
|
|
const path = "src/components/CcForecastFormOrder.tsx";
|
|
let src = fs.readFileSync(path, "utf8");
|
|
|
|
if (src.includes("PACKING_FILL_TIPS")) {
|
|
console.log("already");
|
|
process.exit(0);
|
|
}
|
|
|
|
src = src.replace(
|
|
/} from "@\/constants\/ui-copy";\r?\n/,
|
|
`} from "@/constants/ui-copy";\r\nimport { PACKING_FILL_TIPS } from "@/services/parse/packing-fill-rules";\r\n`,
|
|
);
|
|
|
|
const re =
|
|
/(<div className="cc-fo-step2">\r?\n)(\s*<div className="cc-fo-toolbar">)/;
|
|
if (!re.test(src)) throw new Error("step2 not found");
|
|
|
|
src = src.replace(
|
|
re,
|
|
`$1 <div
|
|
className="cc-fo-packing-tips"
|
|
style={{
|
|
marginBottom: 10,
|
|
padding: "8px 10px",
|
|
fontSize: 12,
|
|
lineHeight: 1.55,
|
|
color: "#4b5563",
|
|
background: "rgba(37,99,235,0.06)",
|
|
borderRadius: 6,
|
|
}}
|
|
>
|
|
<div style={{ fontWeight: 600, marginBottom: 4, color: "#1f2937" }}>
|
|
\u8d27\u4ef6\u586b\u5199\u987b\u77e5\uff08\u5df2\u5199\u5165\u7cfb\u7edf\u6821\u9a8c\uff1b\u6a21\u677f\u300c\u6ce8\u610f\u300d\u8bf4\u660e\u884c\u4e0d\u5165\u8868\uff09
|
|
</div>
|
|
<ol style={{ margin: 0, paddingLeft: 18 }}>
|
|
{PACKING_FILL_TIPS.map((t) => (
|
|
<li key={t}>{t}</li>
|
|
))}
|
|
</ol>
|
|
</div>
|
|
$2`,
|
|
);
|
|
|
|
fs.writeFileSync(path, src);
|
|
console.log("ok", src.includes("PACKING_FILL_TIPS.map"));
|