civic-backup / scripts /quick_check.py
khiemdztv's picture
Sắp xếp lại repo + README hướng dẫn chạy/kiểm thử cho Ban Tổ chức
3ccc46c verified
Raw History Blame Contribute Delete
507 Bytes
import re
import subprocess
from pathlib import Path
html = Path("static_space/index.html").read_text(encoding="utf-8")
scripts = re.findall(r"<script>(.*?)</script>", html, re.DOTALL)
for i, s in enumerate(scripts):
Path(f"/tmp/check_{i}.js").write_text(s, encoding="utf-8")
res = subprocess.run(["node", "--check", f"/tmp/check_{i}.js"], capture_output=True, text=True)
if res.returncode == 0:
print("Syntax check passed!")
else:
print("Syntax check failed:", res.stderr)