fix: use npx to run pa11y if not globally installed in check_wcag.py

Co-authored-by: aider (o3) <aider@aider.chat>
This commit is contained in:
Mark Eaton
2025-09-17 13:55:29 -04:00
co-authored by aider
parent 3c329a5fe6
commit ef1c0bdf7e
+3 -1
View File
@@ -23,6 +23,7 @@ import csv
import json
import subprocess
import sys
import shutil
from pathlib import Path
from typing import Dict, List, Set
@@ -37,8 +38,9 @@ def run_pa11y(url: str) -> List[dict]:
Returns an empty list if pa11y fails.
"""
try:
cmd_base = ["pa11y"] if shutil.which("pa11y") else ["npx", "pa11y"]
result = subprocess.run(
["pa11y", url, "--standard", "WCAG2AA", "--reporter", "json"],
[*cmd_base, url, "--standard", "WCAG2AA", "--reporter", "json"],
capture_output=True,
text=True,
check=False,