aria-ease 6.3.0 → 6.4.0
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/README.md +40 -0
- package/bin/badgeHelper-EF46NFBK.js +15 -0
- package/bin/chunk-BL5SM4CS.js +107 -0
- package/bin/cli.cjs +166 -22
- package/bin/cli.js +19 -1
- package/bin/{test-XSDP2NX3.js → test-GW5LU2JF.js} +16 -1
- package/dist/badgeHelper-Z2LF5OYS.js +108 -0
- package/dist/chunk-I2KLQ2HA.js +22 -0
- package/dist/{chunk-RDEAG4KE.js → chunk-XLG3MIPQ.js} +0 -20
- package/dist/{contractTestRunnerPlaywright-EUXD6ZZK.js → contractTestRunnerPlaywright-JXQUUKFO.js} +5 -3
- package/dist/index.cjs +134 -9
- package/dist/index.js +23 -11
- package/dist/src/accordion/index.cjs +4 -8
- package/dist/src/accordion/index.js +4 -8
- package/dist/src/utils/test/badgeHelper-Y4SEXT4W.js +102 -0
- package/dist/src/utils/test/index.cjs +133 -1
- package/dist/src/utils/test/index.js +16 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,6 +76,46 @@ The CLI will automatically find and load your config file, with validation to ca
|
|
|
76
76
|
|
|
77
77
|
**Perfect for CI/CD pipelines** to catch accessibility issues before production!
|
|
78
78
|
|
|
79
|
+
#### 🏅 Show Your Accessibility Commitment
|
|
80
|
+
|
|
81
|
+
After auditing your project, show the world you care about accessibility! Add a badge to your README:
|
|
82
|
+
|
|
83
|
+
**For projects audited with aria-ease:**
|
|
84
|
+
|
|
85
|
+
[](https://github.com/aria-ease/aria-ease)
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
[](https://github.com/aria-ease/aria-ease)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**For projects with tested components:**
|
|
92
|
+
|
|
93
|
+
[](https://github.com/aria-ease/aria-ease)
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
[](https://github.com/aria-ease/aria-ease)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**For projects using both audits and component tests:**
|
|
100
|
+
|
|
101
|
+
[](https://github.com/aria-ease/aria-ease)
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
[](https://github.com/aria-ease/aria-ease)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Alternative styles:**
|
|
108
|
+
|
|
109
|
+
[](https://github.com/aria-ease/aria-ease) [](https://github.com/aria-ease/aria-ease)
|
|
110
|
+
|
|
111
|
+
**Why add the badge?**
|
|
112
|
+
- ✅ Shows your commitment to accessibility
|
|
113
|
+
- 🔍 Helps us discover projects using aria-ease
|
|
114
|
+
- 🌟 Promotes accessibility best practices in the community
|
|
115
|
+
- 📈 Free marketing for both your project and aria-ease!
|
|
116
|
+
|
|
117
|
+
> **Tip:** The CLI will prompt you to add the appropriate badge automatically after running audits or tests!
|
|
118
|
+
|
|
79
119
|
---
|
|
80
120
|
|
|
81
121
|
## 📚 Component API
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BADGE_CONFIGS,
|
|
3
|
+
displayAllBadges,
|
|
4
|
+
displayBadgeInfo,
|
|
5
|
+
getBadgeMarkdown,
|
|
6
|
+
promptAddBadge
|
|
7
|
+
} from "./chunk-BL5SM4CS.js";
|
|
8
|
+
import "./chunk-I2KLQ2HA.js";
|
|
9
|
+
export {
|
|
10
|
+
BADGE_CONFIGS,
|
|
11
|
+
displayAllBadges,
|
|
12
|
+
displayBadgeInfo,
|
|
13
|
+
getBadgeMarkdown,
|
|
14
|
+
promptAddBadge
|
|
15
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// src/utils/cli/badgeHelper.ts
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import readline from "readline";
|
|
6
|
+
var BADGE_CONFIGS = {
|
|
7
|
+
audit: {
|
|
8
|
+
type: "audit",
|
|
9
|
+
fileName: "audited-by-aria-ease.svg",
|
|
10
|
+
label: "Audited by aria-ease",
|
|
11
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
|
|
12
|
+
},
|
|
13
|
+
component: {
|
|
14
|
+
type: "component",
|
|
15
|
+
fileName: "components-tested-aria-ease.svg",
|
|
16
|
+
label: "Components tested: aria-ease",
|
|
17
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
|
|
18
|
+
},
|
|
19
|
+
verified: {
|
|
20
|
+
type: "verified",
|
|
21
|
+
fileName: "verified-by-aria-ease.svg",
|
|
22
|
+
label: "Verified by aria-ease",
|
|
23
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
function getBadgeMarkdown(badgeType) {
|
|
27
|
+
const config = BADGE_CONFIGS[badgeType];
|
|
28
|
+
return `[](https://github.com/aria-ease/aria-ease)`;
|
|
29
|
+
}
|
|
30
|
+
function displayBadgeInfo(badgeType) {
|
|
31
|
+
const markdown = getBadgeMarkdown(badgeType);
|
|
32
|
+
console.log(chalk.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
|
|
33
|
+
console.log(chalk.white(" Add this badge to your README.md:\n"));
|
|
34
|
+
console.log(chalk.green(" " + markdown));
|
|
35
|
+
console.log(chalk.dim("\n This helps others discover accessibility tools and shows you care!\n"));
|
|
36
|
+
}
|
|
37
|
+
async function promptAddBadge(badgeType, cwd = process.cwd()) {
|
|
38
|
+
const readmePath = path.join(cwd, "README.md");
|
|
39
|
+
const readmeExists = await fs.pathExists(readmePath);
|
|
40
|
+
if (!readmeExists) {
|
|
41
|
+
console.log(chalk.yellow(" \u2139\uFE0F No README.md found in current directory"));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const readmeContent = await fs.readFile(readmePath, "utf-8");
|
|
45
|
+
const markdown = getBadgeMarkdown(badgeType);
|
|
46
|
+
if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
|
|
47
|
+
console.log(chalk.gray(" \u2713 Badge already in README.md"));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const rl = readline.createInterface({
|
|
51
|
+
input: process.stdin,
|
|
52
|
+
output: process.stdout
|
|
53
|
+
});
|
|
54
|
+
const answer = await new Promise((resolve) => {
|
|
55
|
+
rl.question(chalk.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
|
|
56
|
+
rl.close();
|
|
57
|
+
resolve(ans.toLowerCase().trim());
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
if (answer === "y" || answer === "yes") {
|
|
61
|
+
await addBadgeToReadme(readmePath, readmeContent, markdown);
|
|
62
|
+
console.log(chalk.green(" \u2713 Badge added to README.md!"));
|
|
63
|
+
} else {
|
|
64
|
+
console.log(chalk.gray(" Skipped. You can add it manually anytime."));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async function addBadgeToReadme(readmePath, content, badge) {
|
|
68
|
+
const lines = content.split("\n");
|
|
69
|
+
let insertIndex = 0;
|
|
70
|
+
for (let i = 0; i < lines.length; i++) {
|
|
71
|
+
const line = lines[i].trim();
|
|
72
|
+
if (line.startsWith("[![") || line.startsWith("[!")) {
|
|
73
|
+
insertIndex = i + 1;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
if (insertIndex === 0 && line.startsWith("#")) {
|
|
80
|
+
insertIndex = i + 2;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (insertIndex === 0) {
|
|
85
|
+
insertIndex = 1;
|
|
86
|
+
}
|
|
87
|
+
lines.splice(insertIndex, 0, badge);
|
|
88
|
+
await fs.writeFile(readmePath, lines.join("\n"), "utf-8");
|
|
89
|
+
}
|
|
90
|
+
function displayAllBadges() {
|
|
91
|
+
console.log(chalk.cyan("\n\u{1F4CD} Available badges:"));
|
|
92
|
+
console.log(chalk.white("\n For audits:"));
|
|
93
|
+
console.log(chalk.green(" " + getBadgeMarkdown("audit")));
|
|
94
|
+
console.log(chalk.white("\n For component testing:"));
|
|
95
|
+
console.log(chalk.green(" " + getBadgeMarkdown("component")));
|
|
96
|
+
console.log(chalk.white("\n For both (verified):"));
|
|
97
|
+
console.log(chalk.green(" " + getBadgeMarkdown("verified")));
|
|
98
|
+
console.log("");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
BADGE_CONFIGS,
|
|
103
|
+
getBadgeMarkdown,
|
|
104
|
+
displayBadgeInfo,
|
|
105
|
+
promptAddBadge,
|
|
106
|
+
displayAllBadges
|
|
107
|
+
};
|
package/bin/cli.cjs
CHANGED
|
@@ -31,6 +31,120 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
mod
|
|
32
32
|
));
|
|
33
33
|
|
|
34
|
+
// src/utils/cli/badgeHelper.ts
|
|
35
|
+
var badgeHelper_exports = {};
|
|
36
|
+
__export(badgeHelper_exports, {
|
|
37
|
+
BADGE_CONFIGS: () => BADGE_CONFIGS,
|
|
38
|
+
displayAllBadges: () => displayAllBadges,
|
|
39
|
+
displayBadgeInfo: () => displayBadgeInfo,
|
|
40
|
+
getBadgeMarkdown: () => getBadgeMarkdown,
|
|
41
|
+
promptAddBadge: () => promptAddBadge
|
|
42
|
+
});
|
|
43
|
+
function getBadgeMarkdown(badgeType) {
|
|
44
|
+
const config = BADGE_CONFIGS[badgeType];
|
|
45
|
+
return `[](https://github.com/aria-ease/aria-ease)`;
|
|
46
|
+
}
|
|
47
|
+
function displayBadgeInfo(badgeType) {
|
|
48
|
+
const markdown = getBadgeMarkdown(badgeType);
|
|
49
|
+
console.log(import_chalk.default.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
|
|
50
|
+
console.log(import_chalk.default.white(" Add this badge to your README.md:\n"));
|
|
51
|
+
console.log(import_chalk.default.green(" " + markdown));
|
|
52
|
+
console.log(import_chalk.default.dim("\n This helps others discover accessibility tools and shows you care!\n"));
|
|
53
|
+
}
|
|
54
|
+
async function promptAddBadge(badgeType, cwd = process.cwd()) {
|
|
55
|
+
const readmePath = import_path2.default.join(cwd, "README.md");
|
|
56
|
+
const readmeExists = await import_fs_extra2.default.pathExists(readmePath);
|
|
57
|
+
if (!readmeExists) {
|
|
58
|
+
console.log(import_chalk.default.yellow(" \u2139\uFE0F No README.md found in current directory"));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const readmeContent = await import_fs_extra2.default.readFile(readmePath, "utf-8");
|
|
62
|
+
const markdown = getBadgeMarkdown(badgeType);
|
|
63
|
+
if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
|
|
64
|
+
console.log(import_chalk.default.gray(" \u2713 Badge already in README.md"));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const rl = import_readline.default.createInterface({
|
|
68
|
+
input: process.stdin,
|
|
69
|
+
output: process.stdout
|
|
70
|
+
});
|
|
71
|
+
const answer = await new Promise((resolve) => {
|
|
72
|
+
rl.question(import_chalk.default.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
|
|
73
|
+
rl.close();
|
|
74
|
+
resolve(ans.toLowerCase().trim());
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
if (answer === "y" || answer === "yes") {
|
|
78
|
+
await addBadgeToReadme(readmePath, readmeContent, markdown);
|
|
79
|
+
console.log(import_chalk.default.green(" \u2713 Badge added to README.md!"));
|
|
80
|
+
} else {
|
|
81
|
+
console.log(import_chalk.default.gray(" Skipped. You can add it manually anytime."));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async function addBadgeToReadme(readmePath, content, badge) {
|
|
85
|
+
const lines = content.split("\n");
|
|
86
|
+
let insertIndex = 0;
|
|
87
|
+
for (let i = 0; i < lines.length; i++) {
|
|
88
|
+
const line = lines[i].trim();
|
|
89
|
+
if (line.startsWith("[![") || line.startsWith("[!")) {
|
|
90
|
+
insertIndex = i + 1;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
if (insertIndex === 0 && line.startsWith("#")) {
|
|
97
|
+
insertIndex = i + 2;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (insertIndex === 0) {
|
|
102
|
+
insertIndex = 1;
|
|
103
|
+
}
|
|
104
|
+
lines.splice(insertIndex, 0, badge);
|
|
105
|
+
await import_fs_extra2.default.writeFile(readmePath, lines.join("\n"), "utf-8");
|
|
106
|
+
}
|
|
107
|
+
function displayAllBadges() {
|
|
108
|
+
console.log(import_chalk.default.cyan("\n\u{1F4CD} Available badges:"));
|
|
109
|
+
console.log(import_chalk.default.white("\n For audits:"));
|
|
110
|
+
console.log(import_chalk.default.green(" " + getBadgeMarkdown("audit")));
|
|
111
|
+
console.log(import_chalk.default.white("\n For component testing:"));
|
|
112
|
+
console.log(import_chalk.default.green(" " + getBadgeMarkdown("component")));
|
|
113
|
+
console.log(import_chalk.default.white("\n For both (verified):"));
|
|
114
|
+
console.log(import_chalk.default.green(" " + getBadgeMarkdown("verified")));
|
|
115
|
+
console.log("");
|
|
116
|
+
}
|
|
117
|
+
var import_fs_extra2, import_path2, import_chalk, import_readline, BADGE_CONFIGS;
|
|
118
|
+
var init_badgeHelper = __esm({
|
|
119
|
+
"src/utils/cli/badgeHelper.ts"() {
|
|
120
|
+
"use strict";
|
|
121
|
+
import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
122
|
+
import_path2 = __toESM(require("path"), 1);
|
|
123
|
+
import_chalk = __toESM(require("chalk"), 1);
|
|
124
|
+
import_readline = __toESM(require("readline"), 1);
|
|
125
|
+
BADGE_CONFIGS = {
|
|
126
|
+
audit: {
|
|
127
|
+
type: "audit",
|
|
128
|
+
fileName: "audited-by-aria-ease.svg",
|
|
129
|
+
label: "Audited by aria-ease",
|
|
130
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
|
|
131
|
+
},
|
|
132
|
+
component: {
|
|
133
|
+
type: "component",
|
|
134
|
+
fileName: "components-tested-aria-ease.svg",
|
|
135
|
+
label: "Components tested: aria-ease",
|
|
136
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
|
|
137
|
+
},
|
|
138
|
+
verified: {
|
|
139
|
+
type: "verified",
|
|
140
|
+
fileName: "verified-by-aria-ease.svg",
|
|
141
|
+
label: "Verified by aria-ease",
|
|
142
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
34
148
|
// src/utils/audit/src/audit/audit.ts
|
|
35
149
|
var audit_exports = {};
|
|
36
150
|
__export(audit_exports, {
|
|
@@ -1407,16 +1521,31 @@ var init_test2 = __esm({
|
|
|
1407
1521
|
console.log(`\u{1F680} Running component accessibility tests...
|
|
1408
1522
|
`);
|
|
1409
1523
|
const { exec } = await import("child_process");
|
|
1524
|
+
const chalk3 = (await import("chalk")).default;
|
|
1410
1525
|
exec(
|
|
1411
1526
|
`npx vitest --run --reporter verbose`,
|
|
1412
1527
|
{ cwd: process.cwd() },
|
|
1413
|
-
(error, stdout, stderr) => {
|
|
1528
|
+
async (error, stdout, stderr) => {
|
|
1414
1529
|
if (stdout) {
|
|
1415
1530
|
console.log(stdout);
|
|
1416
1531
|
}
|
|
1417
1532
|
if (stderr) {
|
|
1418
1533
|
console.error(stderr);
|
|
1419
1534
|
}
|
|
1535
|
+
if (!error || error.code === 0) {
|
|
1536
|
+
try {
|
|
1537
|
+
const { displayBadgeInfo: displayBadgeInfo2, promptAddBadge: promptAddBadge2 } = await Promise.resolve().then(() => (init_badgeHelper(), badgeHelper_exports));
|
|
1538
|
+
displayBadgeInfo2("component");
|
|
1539
|
+
await promptAddBadge2("component", process.cwd());
|
|
1540
|
+
console.log(chalk3.dim("\n" + "\u2500".repeat(60)));
|
|
1541
|
+
console.log(chalk3.cyan("\u{1F499} Found aria-ease helpful?"));
|
|
1542
|
+
console.log(chalk3.white(" \u2022 Star us on GitHub: ") + chalk3.blue.underline("https://github.com/aria-ease/aria-ease"));
|
|
1543
|
+
console.log(chalk3.white(" \u2022 Share feedback: ") + chalk3.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
|
|
1544
|
+
console.log(chalk3.dim("\u2500".repeat(60) + "\n"));
|
|
1545
|
+
} catch (badgeError) {
|
|
1546
|
+
console.error("Warning: Could not display badge prompt:", badgeError);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1420
1549
|
if (error && error.code) {
|
|
1421
1550
|
process.exit(error.code);
|
|
1422
1551
|
}
|
|
@@ -1443,9 +1572,9 @@ var init_test3 = __esm({
|
|
|
1443
1572
|
|
|
1444
1573
|
// src/utils/cli/cli.ts
|
|
1445
1574
|
var import_commander = require("commander");
|
|
1446
|
-
var
|
|
1447
|
-
var
|
|
1448
|
-
var
|
|
1575
|
+
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
1576
|
+
var import_path3 = __toESM(require("path"), 1);
|
|
1577
|
+
var import_fs_extra3 = __toESM(require("fs-extra"), 1);
|
|
1449
1578
|
|
|
1450
1579
|
// src/utils/cli/configLoader.ts
|
|
1451
1580
|
var import_path = __toESM(require("path"), 1);
|
|
@@ -1564,34 +1693,35 @@ async function loadConfig(cwd = process.cwd()) {
|
|
|
1564
1693
|
}
|
|
1565
1694
|
|
|
1566
1695
|
// src/utils/cli/cli.ts
|
|
1696
|
+
init_badgeHelper();
|
|
1567
1697
|
var program = new import_commander.Command();
|
|
1568
1698
|
program.name("aria-ease").description("Run accessibility tests and audits").version("2.2.3");
|
|
1569
1699
|
program.command("audit").description("Run axe-core powered accessibility audit on webpages").option("-u, --url <url>", "Single URL to audit").option("-f, --format <format>", "Output format for the audit report: json | csv | html | all", "all").option("-o, --out <path>", "Directory to save the audit report", "./accessibility-reports/audit").action(async (opts) => {
|
|
1570
|
-
console.log(
|
|
1700
|
+
console.log(import_chalk2.default.cyanBright("\u{1F680} Starting accessibility audit...\n"));
|
|
1571
1701
|
const { runAudit: runAudit2 } = await Promise.resolve().then(() => (init_audit(), audit_exports));
|
|
1572
1702
|
const { formatResults: formatResults2 } = await Promise.resolve().then(() => (init_formatters(), formatters_exports));
|
|
1573
1703
|
const { config, configPath, errors } = await loadConfig(process.cwd());
|
|
1574
1704
|
if (configPath) {
|
|
1575
|
-
console.log(
|
|
1705
|
+
console.log(import_chalk2.default.green(`\u2705 Loaded config from ${import_path3.default.basename(configPath)}
|
|
1576
1706
|
`));
|
|
1577
1707
|
} else if (errors.length > 0) {
|
|
1578
|
-
console.log(
|
|
1579
|
-
errors.forEach((err) => console.log(
|
|
1708
|
+
console.log(import_chalk2.default.red("\u274C Config file errors:\n"));
|
|
1709
|
+
errors.forEach((err) => console.log(import_chalk2.default.red(` ${err}`)));
|
|
1580
1710
|
console.log("");
|
|
1581
1711
|
process.exit(1);
|
|
1582
1712
|
} else {
|
|
1583
|
-
console.log(
|
|
1713
|
+
console.log(import_chalk2.default.yellow("\u2139\uFE0F No config file found, using CLI options.\n"));
|
|
1584
1714
|
}
|
|
1585
1715
|
const urls = [];
|
|
1586
1716
|
if (opts.url) urls.push(opts.url);
|
|
1587
1717
|
if (config.audit?.urls && Array.isArray(config.audit.urls)) urls.push(...config.audit.urls);
|
|
1588
1718
|
const format = config.audit?.output && config.audit.output.format || opts.format;
|
|
1589
1719
|
if (!["json", "csv", "html", "all"].includes(format)) {
|
|
1590
|
-
console.log(
|
|
1720
|
+
console.log(import_chalk2.default.red('\u274C Invalid format. Use "json", "csv", "html" or "all".'));
|
|
1591
1721
|
process.exit(1);
|
|
1592
1722
|
}
|
|
1593
1723
|
if (urls.length === 0) {
|
|
1594
|
-
console.log(
|
|
1724
|
+
console.log(import_chalk2.default.red('\u274C No URLs provided. Use --url option or add "urls" in config file'));
|
|
1595
1725
|
process.exit(1);
|
|
1596
1726
|
}
|
|
1597
1727
|
const allResults = [];
|
|
@@ -1600,15 +1730,15 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
1600
1730
|
try {
|
|
1601
1731
|
const auditOptions = { browser };
|
|
1602
1732
|
for (const url of urls) {
|
|
1603
|
-
console.log(
|
|
1733
|
+
console.log(import_chalk2.default.yellow(`\u{1F50E} Auditing: ${url}`));
|
|
1604
1734
|
try {
|
|
1605
1735
|
const result = await runAudit2(url, auditOptions);
|
|
1606
1736
|
allResults.push({ url, result });
|
|
1607
|
-
console.log(
|
|
1737
|
+
console.log(import_chalk2.default.green(`\u2705 Completed audit for ${url}
|
|
1608
1738
|
`));
|
|
1609
1739
|
} catch (error) {
|
|
1610
1740
|
if (error instanceof Error && error.message) {
|
|
1611
|
-
console.log(
|
|
1741
|
+
console.log(import_chalk2.default.red(`\u274C Failed auditing ${url}: ${error.message}`));
|
|
1612
1742
|
}
|
|
1613
1743
|
}
|
|
1614
1744
|
}
|
|
@@ -1619,32 +1749,46 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
1619
1749
|
if (!hasResults) {
|
|
1620
1750
|
const auditedCount = allResults.filter((r) => r.result).length;
|
|
1621
1751
|
if (auditedCount === 0) {
|
|
1622
|
-
console.log(
|
|
1752
|
+
console.log(import_chalk2.default.red("\u274C No pages were successfully audited."));
|
|
1623
1753
|
process.exit(1);
|
|
1624
1754
|
}
|
|
1625
|
-
console.log(
|
|
1626
|
-
console.log(
|
|
1755
|
+
console.log(import_chalk2.default.green("\n\u{1F389} Great news! No static accessibility violations found!"));
|
|
1756
|
+
console.log(import_chalk2.default.gray(` Audited ${auditedCount} page${auditedCount > 1 ? "s" : ""} successfully.
|
|
1627
1757
|
`));
|
|
1758
|
+
displayBadgeInfo("audit");
|
|
1759
|
+
await promptAddBadge("audit", process.cwd());
|
|
1760
|
+
console.log(import_chalk2.default.dim("\n" + "\u2500".repeat(60)));
|
|
1761
|
+
console.log(import_chalk2.default.cyan("\u{1F499} Found aria-ease helpful?"));
|
|
1762
|
+
console.log(import_chalk2.default.white(" \u2022 Star us on GitHub: ") + import_chalk2.default.blue.underline("https://github.com/aria-ease/aria-ease"));
|
|
1763
|
+
console.log(import_chalk2.default.white(" \u2022 Share feedback: ") + import_chalk2.default.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
|
|
1764
|
+
console.log(import_chalk2.default.dim("\u2500".repeat(60) + "\n"));
|
|
1628
1765
|
process.exit(0);
|
|
1629
1766
|
}
|
|
1630
1767
|
async function createReport(format2) {
|
|
1631
1768
|
const formatted = formatResults2(allResults, format2);
|
|
1632
1769
|
const out = config.audit?.output && config.audit.output.out || opts.out;
|
|
1633
|
-
await
|
|
1770
|
+
await import_fs_extra3.default.ensureDir(out);
|
|
1634
1771
|
const d = /* @__PURE__ */ new Date();
|
|
1635
1772
|
const pad = (n) => String(n).padStart(2, "0");
|
|
1636
1773
|
const timestamp = `${pad(d.getDate())}-${pad(d.getMonth() + 1)}-${d.getFullYear()} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
|
|
1637
1774
|
const fileName = `ariaease-report-${timestamp}.${format2}`;
|
|
1638
|
-
const filePath =
|
|
1639
|
-
await
|
|
1640
|
-
console.log(
|
|
1775
|
+
const filePath = import_path3.default.join(out, fileName);
|
|
1776
|
+
await import_fs_extra3.default.writeFile(filePath, formatted, "utf-8");
|
|
1777
|
+
console.log(import_chalk2.default.magentaBright(`\u{1F4C1} Report saved to ${filePath}`));
|
|
1641
1778
|
}
|
|
1642
1779
|
if (["json", "csv", "html"].includes(format)) {
|
|
1643
1780
|
await createReport(format);
|
|
1644
1781
|
} else if (format === "all") {
|
|
1645
1782
|
await Promise.all(["json", "csv", "html"].map((format2) => createReport(format2)));
|
|
1646
1783
|
}
|
|
1647
|
-
console.log(
|
|
1784
|
+
console.log(import_chalk2.default.green("\n\u{1F389} All audits completed."));
|
|
1785
|
+
displayBadgeInfo("audit");
|
|
1786
|
+
await promptAddBadge("audit", process.cwd());
|
|
1787
|
+
console.log(import_chalk2.default.dim("\n" + "\u2500".repeat(60)));
|
|
1788
|
+
console.log(import_chalk2.default.cyan("\u{1F499} Found aria-ease helpful?"));
|
|
1789
|
+
console.log(import_chalk2.default.white(" \u2022 Star us on GitHub: ") + import_chalk2.default.blue.underline("https://github.com/aria-ease/aria-ease"));
|
|
1790
|
+
console.log(import_chalk2.default.white(" \u2022 Share feedback: ") + import_chalk2.default.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
|
|
1791
|
+
console.log(import_chalk2.default.dim("\u2500".repeat(60) + "\n"));
|
|
1648
1792
|
});
|
|
1649
1793
|
program.command("test").description("Run core a11y accessibility standard tests on UI components").action(async () => {
|
|
1650
1794
|
const { runTest: runTest2 } = await Promise.resolve().then(() => (init_test3(), test_exports2));
|
package/bin/cli.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
displayBadgeInfo,
|
|
4
|
+
promptAddBadge
|
|
5
|
+
} from "./chunk-BL5SM4CS.js";
|
|
2
6
|
import "./chunk-I2KLQ2HA.js";
|
|
3
7
|
|
|
4
8
|
// src/utils/cli/cli.ts
|
|
@@ -185,6 +189,13 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
185
189
|
console.log(chalk.green("\n\u{1F389} Great news! No static accessibility violations found!"));
|
|
186
190
|
console.log(chalk.gray(` Audited ${auditedCount} page${auditedCount > 1 ? "s" : ""} successfully.
|
|
187
191
|
`));
|
|
192
|
+
displayBadgeInfo("audit");
|
|
193
|
+
await promptAddBadge("audit", process.cwd());
|
|
194
|
+
console.log(chalk.dim("\n" + "\u2500".repeat(60)));
|
|
195
|
+
console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
|
|
196
|
+
console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
|
|
197
|
+
console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
|
|
198
|
+
console.log(chalk.dim("\u2500".repeat(60) + "\n"));
|
|
188
199
|
process.exit(0);
|
|
189
200
|
}
|
|
190
201
|
async function createReport(format2) {
|
|
@@ -205,9 +216,16 @@ program.command("audit").description("Run axe-core powered accessibility audit o
|
|
|
205
216
|
await Promise.all(["json", "csv", "html"].map((format2) => createReport(format2)));
|
|
206
217
|
}
|
|
207
218
|
console.log(chalk.green("\n\u{1F389} All audits completed."));
|
|
219
|
+
displayBadgeInfo("audit");
|
|
220
|
+
await promptAddBadge("audit", process.cwd());
|
|
221
|
+
console.log(chalk.dim("\n" + "\u2500".repeat(60)));
|
|
222
|
+
console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
|
|
223
|
+
console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
|
|
224
|
+
console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
|
|
225
|
+
console.log(chalk.dim("\u2500".repeat(60) + "\n"));
|
|
208
226
|
});
|
|
209
227
|
program.command("test").description("Run core a11y accessibility standard tests on UI components").action(async () => {
|
|
210
|
-
const { runTest } = await import("./test-
|
|
228
|
+
const { runTest } = await import("./test-GW5LU2JF.js");
|
|
211
229
|
runTest();
|
|
212
230
|
});
|
|
213
231
|
program.command("help").description("Display help information").action(() => {
|
|
@@ -175,16 +175,31 @@ if (typeof window === "undefined") {
|
|
|
175
175
|
console.log(`\u{1F680} Running component accessibility tests...
|
|
176
176
|
`);
|
|
177
177
|
const { exec } = await import("child_process");
|
|
178
|
+
const chalk = (await import("chalk")).default;
|
|
178
179
|
exec(
|
|
179
180
|
`npx vitest --run --reporter verbose`,
|
|
180
181
|
{ cwd: process.cwd() },
|
|
181
|
-
(error, stdout, stderr) => {
|
|
182
|
+
async (error, stdout, stderr) => {
|
|
182
183
|
if (stdout) {
|
|
183
184
|
console.log(stdout);
|
|
184
185
|
}
|
|
185
186
|
if (stderr) {
|
|
186
187
|
console.error(stderr);
|
|
187
188
|
}
|
|
189
|
+
if (!error || error.code === 0) {
|
|
190
|
+
try {
|
|
191
|
+
const { displayBadgeInfo, promptAddBadge } = await import("./badgeHelper-EF46NFBK.js");
|
|
192
|
+
displayBadgeInfo("component");
|
|
193
|
+
await promptAddBadge("component", process.cwd());
|
|
194
|
+
console.log(chalk.dim("\n" + "\u2500".repeat(60)));
|
|
195
|
+
console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
|
|
196
|
+
console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
|
|
197
|
+
console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
|
|
198
|
+
console.log(chalk.dim("\u2500".repeat(60) + "\n"));
|
|
199
|
+
} catch (badgeError) {
|
|
200
|
+
console.error("Warning: Could not display badge prompt:", badgeError);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
188
203
|
if (error && error.code) {
|
|
189
204
|
process.exit(error.code);
|
|
190
205
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import "./chunk-I2KLQ2HA.js";
|
|
2
|
+
|
|
3
|
+
// src/utils/cli/badgeHelper.ts
|
|
4
|
+
import fs from "fs-extra";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import readline from "readline";
|
|
8
|
+
var BADGE_CONFIGS = {
|
|
9
|
+
audit: {
|
|
10
|
+
type: "audit",
|
|
11
|
+
fileName: "audited-by-aria-ease.svg",
|
|
12
|
+
label: "Audited by aria-ease",
|
|
13
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
|
|
14
|
+
},
|
|
15
|
+
component: {
|
|
16
|
+
type: "component",
|
|
17
|
+
fileName: "components-tested-aria-ease.svg",
|
|
18
|
+
label: "Components tested: aria-ease",
|
|
19
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
|
|
20
|
+
},
|
|
21
|
+
verified: {
|
|
22
|
+
type: "verified",
|
|
23
|
+
fileName: "verified-by-aria-ease.svg",
|
|
24
|
+
label: "Verified by aria-ease",
|
|
25
|
+
markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
function getBadgeMarkdown(badgeType) {
|
|
29
|
+
const config = BADGE_CONFIGS[badgeType];
|
|
30
|
+
return `[](https://github.com/aria-ease/aria-ease)`;
|
|
31
|
+
}
|
|
32
|
+
function displayBadgeInfo(badgeType) {
|
|
33
|
+
const markdown = getBadgeMarkdown(badgeType);
|
|
34
|
+
console.log(chalk.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
|
|
35
|
+
console.log(chalk.white(" Add this badge to your README.md:\n"));
|
|
36
|
+
console.log(chalk.green(" " + markdown));
|
|
37
|
+
console.log(chalk.dim("\n This helps others discover accessibility tools and shows you care!\n"));
|
|
38
|
+
}
|
|
39
|
+
async function promptAddBadge(badgeType, cwd = process.cwd()) {
|
|
40
|
+
const readmePath = path.join(cwd, "README.md");
|
|
41
|
+
const readmeExists = await fs.pathExists(readmePath);
|
|
42
|
+
if (!readmeExists) {
|
|
43
|
+
console.log(chalk.yellow(" \u2139\uFE0F No README.md found in current directory"));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const readmeContent = await fs.readFile(readmePath, "utf-8");
|
|
47
|
+
const markdown = getBadgeMarkdown(badgeType);
|
|
48
|
+
if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
|
|
49
|
+
console.log(chalk.gray(" \u2713 Badge already in README.md"));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const rl = readline.createInterface({
|
|
53
|
+
input: process.stdin,
|
|
54
|
+
output: process.stdout
|
|
55
|
+
});
|
|
56
|
+
const answer = await new Promise((resolve) => {
|
|
57
|
+
rl.question(chalk.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
|
|
58
|
+
rl.close();
|
|
59
|
+
resolve(ans.toLowerCase().trim());
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
if (answer === "y" || answer === "yes") {
|
|
63
|
+
await addBadgeToReadme(readmePath, readmeContent, markdown);
|
|
64
|
+
console.log(chalk.green(" \u2713 Badge added to README.md!"));
|
|
65
|
+
} else {
|
|
66
|
+
console.log(chalk.gray(" Skipped. You can add it manually anytime."));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function addBadgeToReadme(readmePath, content, badge) {
|
|
70
|
+
const lines = content.split("\n");
|
|
71
|
+
let insertIndex = 0;
|
|
72
|
+
for (let i = 0; i < lines.length; i++) {
|
|
73
|
+
const line = lines[i].trim();
|
|
74
|
+
if (line.startsWith("[![") || line.startsWith("[!")) {
|
|
75
|
+
insertIndex = i + 1;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
if (insertIndex === 0 && line.startsWith("#")) {
|
|
82
|
+
insertIndex = i + 2;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (insertIndex === 0) {
|
|
87
|
+
insertIndex = 1;
|
|
88
|
+
}
|
|
89
|
+
lines.splice(insertIndex, 0, badge);
|
|
90
|
+
await fs.writeFile(readmePath, lines.join("\n"), "utf-8");
|
|
91
|
+
}
|
|
92
|
+
function displayAllBadges() {
|
|
93
|
+
console.log(chalk.cyan("\n\u{1F4CD} Available badges:"));
|
|
94
|
+
console.log(chalk.white("\n For audits:"));
|
|
95
|
+
console.log(chalk.green(" " + getBadgeMarkdown("audit")));
|
|
96
|
+
console.log(chalk.white("\n For component testing:"));
|
|
97
|
+
console.log(chalk.green(" " + getBadgeMarkdown("component")));
|
|
98
|
+
console.log(chalk.white("\n For both (verified):"));
|
|
99
|
+
console.log(chalk.green(" " + getBadgeMarkdown("verified")));
|
|
100
|
+
console.log("");
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
BADGE_CONFIGS,
|
|
104
|
+
displayAllBadges,
|
|
105
|
+
displayBadgeInfo,
|
|
106
|
+
getBadgeMarkdown,
|
|
107
|
+
promptAddBadge
|
|
108
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
__export,
|
|
21
|
+
__reExport
|
|
22
|
+
};
|