equall-cli 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  __toESM,
8
8
  globby,
9
9
  runScan
10
- } from "./chunk-5YPLWCOT.js";
10
+ } from "./chunk-CMP4ST3J.js";
11
11
 
12
12
  // node_modules/commander/lib/error.js
13
13
  var require_error = __commonJS({
@@ -3011,6 +3011,8 @@ var require_commander = __commonJS({
3011
3011
 
3012
3012
  // src/cli.ts
3013
3013
  import { resolve as resolve2, basename } from "path";
3014
+ import { readFileSync, existsSync, statSync } from "fs";
3015
+ import { fileURLToPath } from "url";
3014
3016
 
3015
3017
  // node_modules/commander/esm.mjs
3016
3018
  var import_index = __toESM(require_commander(), 1);
@@ -6716,6 +6718,28 @@ async function findIgnores(rootPath) {
6716
6718
  }
6717
6719
  return entries.sort((a, b) => a.file_path.localeCompare(b.file_path) || a.line - b.line);
6718
6720
  }
6721
+ async function addIgnoreFile(rootPath, filePath) {
6722
+ const absolutePath = resolve(rootPath, filePath);
6723
+ let content;
6724
+ try {
6725
+ content = await readFile(absolutePath, "utf-8");
6726
+ } catch {
6727
+ return null;
6728
+ }
6729
+ const lines = content.split("\n");
6730
+ if (lines.slice(0, 5).some((l) => l.includes("equall-ignore-file"))) {
6731
+ return null;
6732
+ }
6733
+ const ext = filePath.split(".").pop()?.toLowerCase();
6734
+ let comment;
6735
+ if (ext === "html" || ext === "htm") {
6736
+ comment = "<!-- equall-ignore-file -->";
6737
+ } else {
6738
+ comment = "// equall-ignore-file";
6739
+ }
6740
+ await writeFile(absolutePath, comment + "\n" + content, "utf-8");
6741
+ return { file: filePath, comment };
6742
+ }
6719
6743
  async function removeIgnore(rootPath, target) {
6720
6744
  const ignores = await findIgnores(rootPath);
6721
6745
  const colonIdx = target.lastIndexOf(":");
@@ -6809,8 +6833,10 @@ async function clearAllIgnores(rootPath) {
6809
6833
  }
6810
6834
 
6811
6835
  // src/cli.ts
6836
+ var __dir = resolve2(fileURLToPath(import.meta.url), "..");
6837
+ var pkg = JSON.parse(readFileSync(resolve2(__dir, "..", "package.json"), "utf-8"));
6812
6838
  var program2 = new Command();
6813
- program2.name("equall").description("Open-source accessibility scoring \u2014 aggregates axe-core, eslint-plugin-jsx-a11y, and more.").version("0.1.0");
6839
+ program2.name("equall").description("Open-source accessibility scoring \u2014 aggregates axe-core, eslint-plugin-jsx-a11y, and more.").version(pkg.version);
6814
6840
  program2.command("scan").description("Scan a project for accessibility issues").argument("[path]", "Path to project root", ".").option("-l, --level <level>", "WCAG conformance target: A, AA, or AAA", "AA").option("--include <patterns...>", "Glob patterns to include").option("--exclude <patterns...>", "Glob patterns to exclude").option("--json", "Output results as JSON").option("-i, --show-ignored", "Show ignored issues in output").option("--no-color", "Disable colored output").action(async (path, opts) => {
6815
6841
  const level = opts.level.toUpperCase();
6816
6842
  if (!["A", "AA", "AAA"].includes(level)) {
@@ -6895,6 +6921,21 @@ program2.command("ignore").description("Add, list, or remove equall-ignore comme
6895
6921
  console.log(`
6896
6922
  ${GREEN2}Added${RESET2} ${result.file}:${result.line}`);
6897
6923
  console.log(` ${DIM2}${result.comment.trim()}${RESET2}
6924
+ `);
6925
+ return;
6926
+ }
6927
+ const isDirectory = target && existsSync(resolve2(rootPath, target)) && statSync(resolve2(rootPath, target)).isDirectory();
6928
+ if (target && !isDirectory && (target.includes("/") || target.match(/\.\w+$/))) {
6929
+ const result = await addIgnoreFile(rootPath, target);
6930
+ if (!result) {
6931
+ console.error(`
6932
+ Could not ignore ${target}. File not found or already ignored.
6933
+ `);
6934
+ process.exit(1);
6935
+ }
6936
+ console.log(`
6937
+ ${GREEN2}Added${RESET2} ${result.file}`);
6938
+ console.log(` ${DIM2}${result.comment}${RESET2}
6898
6939
  `);
6899
6940
  return;
6900
6941
  }
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { createRequire as __createRequire } from 'module'; import { fileURLToPat
2
2
  import {
3
3
  computeScanResult,
4
4
  runScan
5
- } from "./chunk-5YPLWCOT.js";
5
+ } from "./chunk-CMP4ST3J.js";
6
6
  export {
7
7
  computeScanResult,
8
8
  runScan
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "equall-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Open-source accessibility scoring CLI — aggregates axe-core, eslint-plugin-jsx-a11y, and more into a unified score.",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -51,12 +51,14 @@
51
51
  "@types/jsdom": "^21.1.7",
52
52
  "@types/node": "^22.0.0",
53
53
  "axe-core": "^4.10.0",
54
+ "cheerio": "^1.2.0",
54
55
  "commander": "^12.1.0",
55
56
  "eslint": "^9.0.0",
56
57
  "eslint-plugin-jsx-a11y": "^6.10.0",
57
58
  "globby": "^14.0.0",
58
59
  "jsdom": "^25.0.0",
59
60
  "ora": "^9.3.0",
61
+ "text-readability": "^1.1.1",
60
62
  "tsup": "^8.0.0",
61
63
  "tsx": "^4.0.0",
62
64
  "typescript": "^5.9.3",