Strictly correct indent and formatting on Vue demo patches.

This commit is contained in:
2026-01-17 23:21:01 +00:00
parent 2dec331afb
commit 71d4e053a7
+11 -10
View File
@@ -17,6 +17,7 @@ import subprocess
import sys import sys
import tomllib import tomllib
from pathlib import Path from pathlib import Path
from textwrap import indent
import tomli_w import tomli_w
@@ -413,21 +414,21 @@ def patch_frontend_health_check(frontend_dir: Path, dry_run: bool = False) -> bo
# For App.vue (minimal): insert before the last </p> in template # For App.vue (minimal): insert before the last </p> in template
if "HelloWorld" in str(target_file): if "HelloWorld" in str(target_file):
# Insert before closing </h3> # Insert before closing </h3>
h3_close = content.find("</h3>") h3_close = content.find(" </h3>")
if h3_close != -1: if h3_close == -1:
content = ( return False
f"{content[:h3_close]}\n{STATUS_SPAN_TEMPLATE} {content[h3_close:]}" before, after = content[:h3_close], content[h3_close:]
) content = f"{before}{indent(STATUS_SPAN_TEMPLATE, ' ')}{after}"
else: else:
# Minimal App.vue - insert before the last </p> before </template> # Minimal App.vue - insert before the last </p> before </template>
template_end = content.find("</template>") template_end = content.find("</template>")
if template_end != -1: if template_end != -1:
# Find last </p> before </template> # Find last </p> before </template>
last_p = content.rfind("</p>", 0, template_end) last_p = content.rfind(" </p>", 0, template_end)
if last_p != -1: if last_p == -1:
content = ( return False
f"{content[:last_p]}\n{STATUS_SPAN_TEMPLATE} {content[last_p:]}" before, after = content[:last_p], content[last_p:]
) content = f"{before}{STATUS_SPAN_TEMPLATE}{after}"
target_file.write_text(content) target_file.write_text(content)
print(f"✅ Patched {target_file}") print(f"✅ Patched {target_file}")