mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 11:30:22 +08:00
fix: silenceMnemonGitFlash 回退路径改用 let,避免 const 重赋值抛错
This commit is contained in:
1 parent
dfe217f32b
commit
864e6b7a3b
1 file changed
+5
-12
+5
-12
@@ -261,26 +261,19 @@ export function silenceMnemonGitFlash(dshHome = findDshHome()) {
|
|||||||
if (hit === "missing") hit = "pattern_miss";
|
if (hit === "missing") hit = "pattern_miss";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const next = text.replace(
|
let next = text.replace(
|
||||||
/function resolveGitBranch\(cwd\) \{[\s\S]*?\n\}\n\/\/#endregion\n\/\/#region src\/memory-view\.ts/,
|
/function resolveGitBranch\(cwd\) \{[\s\S]*?\n\}\n\/\/#endregion\n\/\/#region src\/memory-view\.ts/,
|
||||||
`${replacement}\n//#endregion\n//#region src/memory-view.ts`,
|
`${replacement}\n//#endregion\n//#region src/memory-view.ts`,
|
||||||
);
|
);
|
||||||
if (next === text) {
|
if (next === text) {
|
||||||
// Fallback: replace the function only (region comment may differ by mnemon build).
|
// Fallback: replace the function only (region comment may differ by mnemon build).
|
||||||
const alt = text.replace(
|
next = text.replace(
|
||||||
/function resolveGitBranch\(cwd\) \{[\s\S]*?\n\}(?=\n\/\/#endregion)/,
|
/function resolveGitBranch\(cwd\) \{[\s\S]*?\n\}(?=\n\/\/#endregion)/,
|
||||||
replacement,
|
replacement,
|
||||||
);
|
);
|
||||||
if (alt === text) {
|
}
|
||||||
hit = "pattern_miss";
|
if (next === text) {
|
||||||
continue;
|
hit = "pattern_miss";
|
||||||
}
|
|
||||||
try {
|
|
||||||
fs.writeFileSync(fp, alt, "utf8");
|
|
||||||
hit = "patched";
|
|
||||||
} catch (e) {
|
|
||||||
hit = `error:${e}`;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in new issue
Block a user