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:
+3
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user