From 71d4e053a7436f97f78268edffbe914b5099dc49 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sat, 17 Jan 2026 23:21:01 +0000 Subject: [PATCH] Strictly correct indent and formatting on Vue demo patches. --- fastapi_vue_setup.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fastapi_vue_setup.py b/fastapi_vue_setup.py index 2a8685c..b0ac729 100644 --- a/fastapi_vue_setup.py +++ b/fastapi_vue_setup.py @@ -17,6 +17,7 @@ import subprocess import sys import tomllib from pathlib import Path +from textwrap import indent 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

in template if "HelloWorld" in str(target_file): # Insert before closing - h3_close = content.find("") - if h3_close != -1: - content = ( - f"{content[:h3_close]}\n{STATUS_SPAN_TEMPLATE} {content[h3_close:]}" - ) + h3_close = content.find(" ") + if h3_close == -1: + return False + before, after = content[:h3_close], content[h3_close:] + content = f"{before}{indent(STATUS_SPAN_TEMPLATE, ' ')}{after}" else: # Minimal App.vue - insert before the last

before template_end = content.find("") if template_end != -1: # Find last

before - last_p = content.rfind("

", 0, template_end) - if last_p != -1: - content = ( - f"{content[:last_p]}\n{STATUS_SPAN_TEMPLATE} {content[last_p:]}" - ) + last_p = content.rfind("

", 0, template_end) + if last_p == -1: + return False + before, after = content[:last_p], content[last_p:] + content = f"{before}{STATUS_SPAN_TEMPLATE}{after}" target_file.write_text(content) print(f"✅ Patched {target_file}")