diff --git a/lib/core.js b/lib/core.js index 10dd5a8..cbaeb3d 100644 --- a/lib/core.js +++ b/lib/core.js @@ -261,26 +261,19 @@ export function silenceMnemonGitFlash(dshHome = findDshHome()) { if (hit === "missing") hit = "pattern_miss"; continue; } - const next = text.replace( + let next = text.replace( /function resolveGitBranch\(cwd\) \{[\s\S]*?\n\}\n\/\/#endregion\n\/\/#region src\/memory-view\.ts/, `${replacement}\n//#endregion\n//#region src/memory-view.ts`, ); if (next === text) { // 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)/, replacement, ); - if (alt === text) { - hit = "pattern_miss"; - continue; - } - try { - fs.writeFileSync(fp, alt, "utf8"); - hit = "patched"; - } catch (e) { - hit = `error:${e}`; - } + } + if (next === text) { + hit = "pattern_miss"; continue; } try {