255 个版本

0.10.15 2024年2月22日
0.10.14 2023年11月30日
0.10.13 2023年10月13日
0.10.4 2023年6月21日
0.0.54 2022年3月29日

无障碍访问 类别中排名 #4

Download history 1062/week @ 2024-04-29 41/week @ 2024-05-06 63/week @ 2024-05-13 55/week @ 2024-05-20 78/week @ 2024-05-27 44/week @ 2024-06-03 42/week @ 2024-06-10 27/week @ 2024-06-17 27/week @ 2024-06-24 184/week @ 2024-07-01 50/week @ 2024-07-08 18/week @ 2024-07-15 26/week @ 2024-07-22 3327/week @ 2024-07-29 40/week @ 2024-08-05 21/week @ 2024-08-12

3,414 次每月下载

MIT 许可证

105KB
2.5K SLoC

a11ywatch-cli

A11yWatch 命令行界面。查看 cli-docs 以获取更多信息。

安装

  1. cargo安装 a11ywatch_cli

可选

如果您正在使用 Lite 模式,可以在编译时添加功能标志 grpc 以编译 protoc 和 tonic。

Protoc 是必须的。通过安装时使用功能标志 dist-vendor 可提供 OpenSSL 的本地副本,例如: cargo install --path . --features dist-vendor。该标志也适用于通过 npm 安装的 RTN Consuming

Linux

如果您使用的是 Ubuntu,则需要 OpenSSL。您可能需要在 apt-get 前面添加 sudo 命令。

apt-get update && apt upgrade -y && apt-get install -y --no-install-recommends build-essential gcc cmake libc6 libssl-dev pkg-config

Windows

在 Windows 上需要 Cmake

构建

运行以下命令之一以获取 CLI。

# install via cargo
cargo install a11ywatch_cli
# or install via npm
npm i a11ywatch-cli -g

构建初始化

# build the instance first, this allows configuring architecture specifics like apple m1 chips.
a11ywatch build

启动

使用以下命令之一启动实例。如果需要前端客户端,请传递 -f 选项 [需要至少 1.25gb 内存分配给 docker 资源]。

# start the instance requires docker running.
a11ywatch start
# Start the instance with the front-end on port 3270 by default requires docker running..
a11ywatch start -f
# You can also start the system local via `nodejs` monolith.
a11ywatch start --local
# Use the `--standalone` flag to use the monolith in docker.
a11ywatch start --standalone
# If you need to upgrade the instance to new images run with the upgrade flag - can also be used with the build command.
a11ywatch start --upgrade

操作

# scan a url and pipe the stdout to a file.
a11ywatch scan --url https://a11ywatch.com > results.json
# scan a url and attempt to fix code based on recommendations [installs the fast ripgrep crate for search].
a11ywatch scan --url https://a11ywatch.com --fix
# scan and store results as csv to disk.
a11ywatch scan --save --csv --url https://a11ywatch.com
# scan a website multi page and pipe the stdout to a file.
a11ywatch crawl --url https://a11ywatch.com > results.json
# scan a website multi page and include subdomains.
a11ywatch crawl --url https://a11ywatch.com -S > results.json
# scan a website multi page and include subdomains and all TLD extensions.
a11ywatch crawl --url https://a11ywatch.com -S -t > results.json
# scan a website multi page and get results parsed as checklist.
a11ywatch crawl --url https://a11ywatch.com -d -n -s && a11ywatch --results-parsed-list
# crawl and store results as csv to disk.
a11ywatch crawl --save --csv --url https://a11ywatch.com

如果您遇到问题,尝试运行 rustup update stable 以确保您的 cargo 版本是最新版本。

ENV

以下是一些可以配置以增强系统功能的 env 变量。您可以从这里获取您的 计算机视觉 API 密钥。获取您的 PageSpeed API 密钥以加速 lighthouse 并行运行。

以下是一个.env文件的示例

COMPUTER_VISION_SUBSCRIPTION_KEY="REPLACE_WITH_KEY"
COMPUTER_VISION_ENDPOINT="REPLACE_WITH_ENDPOINT"
PAGESPEED_API_KEY="REPLACE_WITH_PAGESPEED_API_KEY"
# set to a directory or true in order to enable recordings in litemode
PAGEMIND_RECORD=

您也可以使用命令行界面(CLI)来配置设置,如计算机视觉凭据、录制视频等。

# replace $mycv_token and $myvcvname with your project name and ComputerVision API url
a11ywatch --set-cv-token $mycv_token
a11ywatch --set-cv-url https://$myvcvname.cognitiveservices.azure.com/
a11ywatch --set-recording ./recordings

示例选项和命令 a11ywatch -h

a11ywatch_cli 0.10.7
j-mendez <[email protected]>
A11yWatch web accessibility CLI.

USAGE:
    a11ywatch [OPTIONS] [SUBCOMMAND]

OPTIONS:
    -c, --clear-token
            Clear the API token to use for requests

        --clear-cv-token
            Clear the Computer Vision API token to use for request

        --clear-recording
            Clear the recording preventing storing video

    -f, --find-results
            Log file results path

        --find-tmp-dir
            Get the apps tmp directory location

    -g, --github-api-url
            Get github API endpoint of project

        --github-results-path
            Log file results github path

    -h, --help
            Print help information

    -r, --results-parsed-list
            Get results file parsed as report list of passed / failed

    -R, --results-parsed
            Get results file parsed to json

        --results-issues
            Get the total amount of issues between errors,warning,notice that occurred for the
            result set

        --results-issues-errors
            Get the total amount of issues of type error from result set

        --results-issues-warnings
            Get the total amount of issues of type warning from result set

        --results-parsed-github
            Get results of the github html message

    -s, --set-token <SET_TOKEN>
            Set the API token to use for requests

        --set-cv-token <SET_CV_TOKEN>
            Set the Computer Vision API token to use for request

        --set-cv-url <SET_CV_URL>
            Set the Computer Vision API endpoint to use for request

        --set-recording <SET_RECORDING>
            Enable recording audits to a directory

    -V, --version
            Print version information

SUBCOMMANDS:
    build      Build A11yWatch Lite on the local machine [defaults to docker runtime]
    crawl      Site wide scan a website url for issues
    extract    Extract results in formats for platforms
    help       Print this message or the help of the given subcommand(s)
    scan       Single page scan a website url for issues
    start      Start A11yWatch Lite on the local machine [defaults to docker runtime]
    stop       Stop A11yWatch Lite on the local machine [defaults to docker runtime]

支持的架构

Mac、Linux和Windows。

功能

  1. grpc - 使用gRPC连接到litemode实例。

帮助

如果您尝试在docker容器内运行运行在localhost的网站,您需要使用您的计算机主机名。

在终端运行命令hostname,然后您可以使用它,例如:a11ywatch crawl --url $(hostname):3000

为了停止服务,请确保传递用于构建/启动实例的正确标志。

依赖项

~12-27MB
~442K SLoC