mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
Run pa11y-ci in cross-platform manner (works on Windows)
This commit is contained in:
parent
98ea848151
commit
82e9074bbe
2 changed files with 7 additions and 1 deletions
|
@ -87,7 +87,7 @@ docs-check = [
|
||||||
{script = "tasks:output_file('sitemap.xml')"},
|
{script = "tasks:output_file('sitemap.xml')"},
|
||||||
{script = "tasks:generate_pa11y_config_from_sitemap"},
|
{script = "tasks:generate_pa11y_config_from_sitemap"},
|
||||||
{script = "tasks:output_file('config.json')"},
|
{script = "tasks:output_file('config.json')"},
|
||||||
{cmd = "npx pa11y-ci -c config.json"},
|
{script = "tasks:run_shell('npx pa11y-ci -c config.json')"},
|
||||||
{script = "tasks:delete_files(['sitemap.xml', 'config.json'])"},
|
{script = "tasks:delete_files(['sitemap.xml', 'config.json'])"},
|
||||||
]
|
]
|
||||||
docs-run = [
|
docs-run = [
|
||||||
|
|
6
tasks.py
6
tasks.py
|
@ -4,6 +4,7 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import subprocess
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import xmltodict
|
import xmltodict
|
||||||
|
@ -18,6 +19,11 @@ def delete_files(files):
|
||||||
pathlib.Path(file).unlink(missing_ok=True)
|
pathlib.Path(file).unlink(missing_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
def run_shell(command):
|
||||||
|
# Required to run NPM commands in Windows and *nix
|
||||||
|
subprocess.call(command, shell=True)
|
||||||
|
|
||||||
|
|
||||||
def generate_sitemap():
|
def generate_sitemap():
|
||||||
sitemap = requests.get(f"{DOCS_URL}/{SITEMAP_FILENAME}")
|
sitemap = requests.get(f"{DOCS_URL}/{SITEMAP_FILENAME}")
|
||||||
with open(SITEMAP_FILENAME, "wb") as f:
|
with open(SITEMAP_FILENAME, "wb") as f:
|
||||||
|
|
Loading…
Add table
Reference in a new issue