npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

apca-check

v0.1.0

Published

Axe rules to check against APCA bronze and silver+ conformance levels.

Downloads

4,689

Readme

apca-check

ci status npm version

This package contains custom axe rules and checks for APCA Bronze and Silver+ conformance levels.

Usage

Installation

npm install --save-dev axe-core apca-check

Setup

import axe from "axe-core";
import { registerAPCACheck } from 'apca-check';

registerAPCACheck('bronze'); // or registerAPCACheck('silver');

 // consider turning off default WCAG 2.2 AA color contrast rules when using APCA
axe.configure({
    rules: [{ id: "color-contrast", enabled: false }]
})

axe.run(document, (err, results) => {
    if (err) throw err;
    console.log(results);
});

Using custom APCA thresholds

To set custom thresholds for APCA checks, follow these steps:

  1. Use custom as the first argument when calling registerAPCACheck.
  2. Provide a function as the second argument, optionally accepting fontSize and fontWeight arguments.
const customConformanceThresholdFn = (fontSize, fontWeight) => {
    const size = parseFloat(fontSize);
    const weight = parseFloat(fontWeight);

    return size >= 32 || weight > 700 ? 45 : 60;
};

registerAPCACheck('custom', customConformanceThresholdFn);

Development

Prerequisites

  • Node.js v18+

Linting

To run eslint (including prettier as a formatter) you can run

npm run lint

To have eslint fix any autofixable issue run

npm run lint:fix

Testing

Tests are run by web-test-runner in combination with playwright against chromium, firefox and webkit

npm run test

For watch mode

npm run test:watch

Publishing

We use changesets to automatize the steps necessary to publish to NPM, create GH releases and a changelog.

  • Every time you do work that requires a new release to be published, add a changesets entry by running npx chageset and follow the instrcutions on screen. (changes that do not require a new release - e.g. changing a test file - don't need a changeset).
    • When opening a PR without a corresponding changeset the changesets-bot will remind you to do so. It generally makes sense to have one changeset for PR (if the PR changes do not require a new release to be published the bot message can be safely ignored)
  • The release github workflow continuosly check if there are new pending changesets in the main branch, if there are it creates a GH PR (chore(release) see example) and continue updating it as more changesets are potentially pushed/merged to the main branch.
  • When we are ready to cut a release we need to simply merge the chore(release) PR back to main and the release github workflow will take care of publishing the changes to NPM and create a GH release for us. The chore(release) PR also give us an opportunity to adjust the automatically generated changelog when necessary (the entry in the changelog file is also what will end up in the GH release notes).

The release github workflow only run if the CI workflow (running linter, formatter and tests) is successful: CI is blocking accidental releases.

Despite using changesets to communicate the intent of creating releases in a more explicit way, we still follow conventional commits standards for keeping our git history easily parseable by the human eye.

License

Copyright 2023 Stack Exchange, Inc and released under the MIT License. axe-core® and axe® are a trademark of Deque Systems, Inc. in the US and other countries.