#!/usr/bin/env python3
"""Verifie la syntaxe du JavaScript embarque dans inventory_gui.py.
Garde-fou : py_compile ne voit pas le JS (il est dans une chaine Python).
Une seule erreur de syntaxe JS casse toute la page. On extrait le JS et on le
passe a `node --check`. Si node est absent, la verification est sautee (signale).
"""
from __future__ import annotations
import re
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
import inventory_gui as g # noqa: E402
def main() -> int:
if not shutil.which("node"):
print("node absent : verification de la syntaxe JS du GUI sautee.")
return 0
html = g.HTML.replace("__JETON__", "TEST")
blocs = re.findall(r"", html, re.S)
if not blocs:
print("erreur: aucun bloc