aria-ease 6.3.1 → 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 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
+ [![Audited by aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg)](https://github.com/aria-ease/aria-ease)
86
+
87
+ ```markdown
88
+ [![Audited by aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg)](https://github.com/aria-ease/aria-ease)
89
+ ```
90
+
91
+ **For projects with tested components:**
92
+
93
+ [![Components tested: aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg)](https://github.com/aria-ease/aria-ease)
94
+
95
+ ```markdown
96
+ [![Components tested: aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg)](https://github.com/aria-ease/aria-ease)
97
+ ```
98
+
99
+ **For projects using both audits and component tests:**
100
+
101
+ [![Verified by aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg)](https://github.com/aria-ease/aria-ease)
102
+
103
+ ```markdown
104
+ [![Verified by aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg)](https://github.com/aria-ease/aria-ease)
105
+ ```
106
+
107
+ **Alternative styles:**
108
+
109
+ [![accessibility: aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/accessibility-aria-ease.svg)](https://github.com/aria-ease/aria-ease) [![a11y audited: ✓ aria-ease](https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/a11y-audited-aria-ease.svg)](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 `[![${config.label}](${config.markdownUrl})](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 `[![${config.label}](${config.markdownUrl})](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 import_chalk = __toESM(require("chalk"), 1);
1447
- var import_path2 = __toESM(require("path"), 1);
1448
- var import_fs_extra2 = __toESM(require("fs-extra"), 1);
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(import_chalk.default.cyanBright("\u{1F680} Starting accessibility audit...\n"));
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(import_chalk.default.green(`\u2705 Loaded config from ${import_path2.default.basename(configPath)}
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(import_chalk.default.red("\u274C Config file errors:\n"));
1579
- errors.forEach((err) => console.log(import_chalk.default.red(` ${err}`)));
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(import_chalk.default.yellow("\u2139\uFE0F No config file found, using CLI options.\n"));
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(import_chalk.default.red('\u274C Invalid format. Use "json", "csv", "html" or "all".'));
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(import_chalk.default.red('\u274C No URLs provided. Use --url option or add "urls" in config file'));
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(import_chalk.default.yellow(`\u{1F50E} Auditing: ${url}`));
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(import_chalk.default.green(`\u2705 Completed audit for ${url}
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(import_chalk.default.red(`\u274C Failed auditing ${url}: ${error.message}`));
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(import_chalk.default.red("\u274C No pages were successfully audited."));
1752
+ console.log(import_chalk2.default.red("\u274C No pages were successfully audited."));
1623
1753
  process.exit(1);
1624
1754
  }
1625
- console.log(import_chalk.default.green("\n\u{1F389} Great news! No static accessibility violations found!"));
1626
- console.log(import_chalk.default.gray(` Audited ${auditedCount} page${auditedCount > 1 ? "s" : ""} successfully.
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 import_fs_extra2.default.ensureDir(out);
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 = import_path2.default.join(out, fileName);
1639
- await import_fs_extra2.default.writeFile(filePath, formatted, "utf-8");
1640
- console.log(import_chalk.default.magentaBright(`\u{1F4C1} Report saved to ${filePath}`));
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(import_chalk.default.green("\n\u{1F389} All audits completed."));
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-XSDP2NX3.js");
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 `[![${config.label}](${config.markdownUrl})](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
+ };
@@ -1,21 +1,3 @@
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
1
  // src/utils/test/contract/contract.json
20
2
  var contract_default = {
21
3
  menu: {
@@ -302,8 +284,6 @@ async function closeSharedBrowser() {
302
284
  }
303
285
 
304
286
  export {
305
- __export,
306
- __reExport,
307
287
  contract_default,
308
288
  ContractReporter,
309
289
  createTestPage,
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  ContractReporter,
3
- __export,
4
- __reExport,
5
3
  contract_default,
6
4
  createTestPage
7
- } from "./chunk-RDEAG4KE.js";
5
+ } from "./chunk-XLG3MIPQ.js";
6
+ import {
7
+ __export,
8
+ __reExport
9
+ } from "./chunk-I2KLQ2HA.js";
8
10
 
9
11
  // node_modules/@playwright/test/index.mjs
10
12
  var test_exports = {};
package/dist/index.cjs CHANGED
@@ -969,6 +969,120 @@ var init_contractTestRunnerPlaywright = __esm({
969
969
  }
970
970
  });
971
971
 
972
+ // src/utils/cli/badgeHelper.ts
973
+ var badgeHelper_exports = {};
974
+ __export(badgeHelper_exports, {
975
+ BADGE_CONFIGS: () => BADGE_CONFIGS,
976
+ displayAllBadges: () => displayAllBadges,
977
+ displayBadgeInfo: () => displayBadgeInfo,
978
+ getBadgeMarkdown: () => getBadgeMarkdown,
979
+ promptAddBadge: () => promptAddBadge
980
+ });
981
+ function getBadgeMarkdown(badgeType) {
982
+ const config = BADGE_CONFIGS[badgeType];
983
+ return `[![${config.label}](${config.markdownUrl})](https://github.com/aria-ease/aria-ease)`;
984
+ }
985
+ function displayBadgeInfo(badgeType) {
986
+ const markdown = getBadgeMarkdown(badgeType);
987
+ console.log(import_chalk.default.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
988
+ console.log(import_chalk.default.white(" Add this badge to your README.md:\n"));
989
+ console.log(import_chalk.default.green(" " + markdown));
990
+ console.log(import_chalk.default.dim("\n This helps others discover accessibility tools and shows you care!\n"));
991
+ }
992
+ async function promptAddBadge(badgeType, cwd = process.cwd()) {
993
+ const readmePath = import_path.default.join(cwd, "README.md");
994
+ const readmeExists = await import_fs_extra.default.pathExists(readmePath);
995
+ if (!readmeExists) {
996
+ console.log(import_chalk.default.yellow(" \u2139\uFE0F No README.md found in current directory"));
997
+ return;
998
+ }
999
+ const readmeContent = await import_fs_extra.default.readFile(readmePath, "utf-8");
1000
+ const markdown = getBadgeMarkdown(badgeType);
1001
+ if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
1002
+ console.log(import_chalk.default.gray(" \u2713 Badge already in README.md"));
1003
+ return;
1004
+ }
1005
+ const rl = import_readline.default.createInterface({
1006
+ input: process.stdin,
1007
+ output: process.stdout
1008
+ });
1009
+ const answer = await new Promise((resolve) => {
1010
+ rl.question(import_chalk.default.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
1011
+ rl.close();
1012
+ resolve(ans.toLowerCase().trim());
1013
+ });
1014
+ });
1015
+ if (answer === "y" || answer === "yes") {
1016
+ await addBadgeToReadme(readmePath, readmeContent, markdown);
1017
+ console.log(import_chalk.default.green(" \u2713 Badge added to README.md!"));
1018
+ } else {
1019
+ console.log(import_chalk.default.gray(" Skipped. You can add it manually anytime."));
1020
+ }
1021
+ }
1022
+ async function addBadgeToReadme(readmePath, content, badge) {
1023
+ const lines = content.split("\n");
1024
+ let insertIndex = 0;
1025
+ for (let i = 0; i < lines.length; i++) {
1026
+ const line = lines[i].trim();
1027
+ if (line.startsWith("[![") || line.startsWith("[!")) {
1028
+ insertIndex = i + 1;
1029
+ continue;
1030
+ }
1031
+ if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
1032
+ break;
1033
+ }
1034
+ if (insertIndex === 0 && line.startsWith("#")) {
1035
+ insertIndex = i + 2;
1036
+ break;
1037
+ }
1038
+ }
1039
+ if (insertIndex === 0) {
1040
+ insertIndex = 1;
1041
+ }
1042
+ lines.splice(insertIndex, 0, badge);
1043
+ await import_fs_extra.default.writeFile(readmePath, lines.join("\n"), "utf-8");
1044
+ }
1045
+ function displayAllBadges() {
1046
+ console.log(import_chalk.default.cyan("\n\u{1F4CD} Available badges:"));
1047
+ console.log(import_chalk.default.white("\n For audits:"));
1048
+ console.log(import_chalk.default.green(" " + getBadgeMarkdown("audit")));
1049
+ console.log(import_chalk.default.white("\n For component testing:"));
1050
+ console.log(import_chalk.default.green(" " + getBadgeMarkdown("component")));
1051
+ console.log(import_chalk.default.white("\n For both (verified):"));
1052
+ console.log(import_chalk.default.green(" " + getBadgeMarkdown("verified")));
1053
+ console.log("");
1054
+ }
1055
+ var import_fs_extra, import_path, import_chalk, import_readline, BADGE_CONFIGS;
1056
+ var init_badgeHelper = __esm({
1057
+ "src/utils/cli/badgeHelper.ts"() {
1058
+ "use strict";
1059
+ import_fs_extra = __toESM(require("fs-extra"), 1);
1060
+ import_path = __toESM(require("path"), 1);
1061
+ import_chalk = __toESM(require("chalk"), 1);
1062
+ import_readline = __toESM(require("readline"), 1);
1063
+ BADGE_CONFIGS = {
1064
+ audit: {
1065
+ type: "audit",
1066
+ fileName: "audited-by-aria-ease.svg",
1067
+ label: "Audited by aria-ease",
1068
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
1069
+ },
1070
+ component: {
1071
+ type: "component",
1072
+ fileName: "components-tested-aria-ease.svg",
1073
+ label: "Components tested: aria-ease",
1074
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
1075
+ },
1076
+ verified: {
1077
+ type: "verified",
1078
+ fileName: "verified-by-aria-ease.svg",
1079
+ label: "Verified by aria-ease",
1080
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
1081
+ }
1082
+ };
1083
+ }
1084
+ });
1085
+
972
1086
  // index.ts
973
1087
  var index_exports = {};
974
1088
  __export(index_exports, {
@@ -2584,16 +2698,31 @@ if (typeof window === "undefined") {
2584
2698
  console.log(`\u{1F680} Running component accessibility tests...
2585
2699
  `);
2586
2700
  const { exec } = await import("child_process");
2701
+ const chalk2 = (await import("chalk")).default;
2587
2702
  exec(
2588
2703
  `npx vitest --run --reporter verbose`,
2589
2704
  { cwd: process.cwd() },
2590
- (error, stdout, stderr) => {
2705
+ async (error, stdout, stderr) => {
2591
2706
  if (stdout) {
2592
2707
  console.log(stdout);
2593
2708
  }
2594
2709
  if (stderr) {
2595
2710
  console.error(stderr);
2596
2711
  }
2712
+ if (!error || error.code === 0) {
2713
+ try {
2714
+ const { displayBadgeInfo: displayBadgeInfo2, promptAddBadge: promptAddBadge2 } = await Promise.resolve().then(() => (init_badgeHelper(), badgeHelper_exports));
2715
+ displayBadgeInfo2("component");
2716
+ await promptAddBadge2("component", process.cwd());
2717
+ console.log(chalk2.dim("\n" + "\u2500".repeat(60)));
2718
+ console.log(chalk2.cyan("\u{1F499} Found aria-ease helpful?"));
2719
+ console.log(chalk2.white(" \u2022 Star us on GitHub: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease"));
2720
+ console.log(chalk2.white(" \u2022 Share feedback: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
2721
+ console.log(chalk2.dim("\u2500".repeat(60) + "\n"));
2722
+ } catch (badgeError) {
2723
+ console.error("Warning: Could not display badge prompt:", badgeError);
2724
+ }
2725
+ }
2597
2726
  if (error && error.code) {
2598
2727
  process.exit(error.code);
2599
2728
  }
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@ import {
2
2
  ContractReporter,
3
3
  closeSharedBrowser,
4
4
  contract_default
5
- } from "./chunk-RDEAG4KE.js";
5
+ } from "./chunk-XLG3MIPQ.js";
6
+ import "./chunk-I2KLQ2HA.js";
6
7
 
7
8
  // src/accordion/src/makeAccordionAccessible/makeAccordionAccessible.ts
8
9
  function makeAccordionAccessible({ accordionId, triggersClass, panelsClass, allowMultipleOpen = false, callback }) {
@@ -1538,7 +1539,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
1538
1539
  const devServerUrl = await checkDevServer(url);
1539
1540
  if (devServerUrl) {
1540
1541
  console.log(`\u{1F3AD} Running Playwright tests on ${devServerUrl}`);
1541
- const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-EUXD6ZZK.js");
1542
+ const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-JXQUUKFO.js");
1542
1543
  contract = await runContractTestsPlaywright(componentName, devServerUrl);
1543
1544
  } else {
1544
1545
  throw new Error(
@@ -1599,16 +1600,31 @@ if (typeof window === "undefined") {
1599
1600
  console.log(`\u{1F680} Running component accessibility tests...
1600
1601
  `);
1601
1602
  const { exec } = await import("child_process");
1603
+ const chalk = (await import("chalk")).default;
1602
1604
  exec(
1603
1605
  `npx vitest --run --reporter verbose`,
1604
1606
  { cwd: process.cwd() },
1605
- (error, stdout, stderr) => {
1607
+ async (error, stdout, stderr) => {
1606
1608
  if (stdout) {
1607
1609
  console.log(stdout);
1608
1610
  }
1609
1611
  if (stderr) {
1610
1612
  console.error(stderr);
1611
1613
  }
1614
+ if (!error || error.code === 0) {
1615
+ try {
1616
+ const { displayBadgeInfo, promptAddBadge } = await import("./badgeHelper-Z2LF5OYS.js");
1617
+ displayBadgeInfo("component");
1618
+ await promptAddBadge("component", process.cwd());
1619
+ console.log(chalk.dim("\n" + "\u2500".repeat(60)));
1620
+ console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
1621
+ console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
1622
+ console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
1623
+ console.log(chalk.dim("\u2500".repeat(60) + "\n"));
1624
+ } catch (badgeError) {
1625
+ console.error("Warning: Could not display badge prompt:", badgeError);
1626
+ }
1627
+ }
1612
1628
  if (error && error.code) {
1613
1629
  process.exit(error.code);
1614
1630
  }
@@ -0,0 +1,102 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ import readline from 'readline';
5
+
6
+ // src/utils/cli/badgeHelper.ts
7
+ var BADGE_CONFIGS = {
8
+ audit: {
9
+ type: "audit",
10
+ fileName: "audited-by-aria-ease.svg",
11
+ label: "Audited by aria-ease",
12
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
13
+ },
14
+ component: {
15
+ type: "component",
16
+ fileName: "components-tested-aria-ease.svg",
17
+ label: "Components tested: aria-ease",
18
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
19
+ },
20
+ verified: {
21
+ type: "verified",
22
+ fileName: "verified-by-aria-ease.svg",
23
+ label: "Verified by aria-ease",
24
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
25
+ }
26
+ };
27
+ function getBadgeMarkdown(badgeType) {
28
+ const config = BADGE_CONFIGS[badgeType];
29
+ return `[![${config.label}](${config.markdownUrl})](https://github.com/aria-ease/aria-ease)`;
30
+ }
31
+ function displayBadgeInfo(badgeType) {
32
+ const markdown = getBadgeMarkdown(badgeType);
33
+ console.log(chalk.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
34
+ console.log(chalk.white(" Add this badge to your README.md:\n"));
35
+ console.log(chalk.green(" " + markdown));
36
+ console.log(chalk.dim("\n This helps others discover accessibility tools and shows you care!\n"));
37
+ }
38
+ async function promptAddBadge(badgeType, cwd = process.cwd()) {
39
+ const readmePath = path.join(cwd, "README.md");
40
+ const readmeExists = await fs.pathExists(readmePath);
41
+ if (!readmeExists) {
42
+ console.log(chalk.yellow(" \u2139\uFE0F No README.md found in current directory"));
43
+ return;
44
+ }
45
+ const readmeContent = await fs.readFile(readmePath, "utf-8");
46
+ const markdown = getBadgeMarkdown(badgeType);
47
+ if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
48
+ console.log(chalk.gray(" \u2713 Badge already in README.md"));
49
+ return;
50
+ }
51
+ const rl = readline.createInterface({
52
+ input: process.stdin,
53
+ output: process.stdout
54
+ });
55
+ const answer = await new Promise((resolve) => {
56
+ rl.question(chalk.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
57
+ rl.close();
58
+ resolve(ans.toLowerCase().trim());
59
+ });
60
+ });
61
+ if (answer === "y" || answer === "yes") {
62
+ await addBadgeToReadme(readmePath, readmeContent, markdown);
63
+ console.log(chalk.green(" \u2713 Badge added to README.md!"));
64
+ } else {
65
+ console.log(chalk.gray(" Skipped. You can add it manually anytime."));
66
+ }
67
+ }
68
+ async function addBadgeToReadme(readmePath, content, badge) {
69
+ const lines = content.split("\n");
70
+ let insertIndex = 0;
71
+ for (let i = 0; i < lines.length; i++) {
72
+ const line = lines[i].trim();
73
+ if (line.startsWith("[![") || line.startsWith("[!")) {
74
+ insertIndex = i + 1;
75
+ continue;
76
+ }
77
+ if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
78
+ break;
79
+ }
80
+ if (insertIndex === 0 && line.startsWith("#")) {
81
+ insertIndex = i + 2;
82
+ break;
83
+ }
84
+ }
85
+ if (insertIndex === 0) {
86
+ insertIndex = 1;
87
+ }
88
+ lines.splice(insertIndex, 0, badge);
89
+ await fs.writeFile(readmePath, lines.join("\n"), "utf-8");
90
+ }
91
+ function displayAllBadges() {
92
+ console.log(chalk.cyan("\n\u{1F4CD} Available badges:"));
93
+ console.log(chalk.white("\n For audits:"));
94
+ console.log(chalk.green(" " + getBadgeMarkdown("audit")));
95
+ console.log(chalk.white("\n For component testing:"));
96
+ console.log(chalk.green(" " + getBadgeMarkdown("component")));
97
+ console.log(chalk.white("\n For both (verified):"));
98
+ console.log(chalk.green(" " + getBadgeMarkdown("verified")));
99
+ console.log("");
100
+ }
101
+
102
+ export { BADGE_CONFIGS, displayAllBadges, displayBadgeInfo, getBadgeMarkdown, promptAddBadge };
@@ -3,12 +3,20 @@
3
3
  var playwright = require('playwright');
4
4
  var test = require('@playwright/test');
5
5
  var fs = require('fs');
6
+ var fs2 = require('fs-extra');
7
+ var path = require('path');
8
+ var chalk = require('chalk');
9
+ var readline = require('readline');
6
10
  var jestAxe = require('jest-axe');
7
11
  var fs$1 = require('fs/promises');
8
12
 
9
13
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
10
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
15
 
16
+ var fs2__default = /*#__PURE__*/_interopDefault(fs2);
17
+ var path__default = /*#__PURE__*/_interopDefault(path);
18
+ var chalk__default = /*#__PURE__*/_interopDefault(chalk);
19
+ var readline__default = /*#__PURE__*/_interopDefault(readline);
12
20
  var fs__default = /*#__PURE__*/_interopDefault(fs$1);
13
21
 
14
22
  var __defProp = Object.defineProperty;
@@ -935,6 +943,115 @@ var init_contractTestRunnerPlaywright = __esm({
935
943
  }
936
944
  });
937
945
 
946
+ // src/utils/cli/badgeHelper.ts
947
+ var badgeHelper_exports = {};
948
+ __export(badgeHelper_exports, {
949
+ BADGE_CONFIGS: () => BADGE_CONFIGS,
950
+ displayAllBadges: () => displayAllBadges,
951
+ displayBadgeInfo: () => displayBadgeInfo,
952
+ getBadgeMarkdown: () => getBadgeMarkdown,
953
+ promptAddBadge: () => promptAddBadge
954
+ });
955
+ function getBadgeMarkdown(badgeType) {
956
+ const config = BADGE_CONFIGS[badgeType];
957
+ return `[![${config.label}](${config.markdownUrl})](https://github.com/aria-ease/aria-ease)`;
958
+ }
959
+ function displayBadgeInfo(badgeType) {
960
+ const markdown = getBadgeMarkdown(badgeType);
961
+ console.log(chalk__default.default.cyan("\n\u{1F3C5} Show your accessibility commitment!"));
962
+ console.log(chalk__default.default.white(" Add this badge to your README.md:\n"));
963
+ console.log(chalk__default.default.green(" " + markdown));
964
+ console.log(chalk__default.default.dim("\n This helps others discover accessibility tools and shows you care!\n"));
965
+ }
966
+ async function promptAddBadge(badgeType, cwd = process.cwd()) {
967
+ const readmePath = path__default.default.join(cwd, "README.md");
968
+ const readmeExists = await fs2__default.default.pathExists(readmePath);
969
+ if (!readmeExists) {
970
+ console.log(chalk__default.default.yellow(" \u2139\uFE0F No README.md found in current directory"));
971
+ return;
972
+ }
973
+ const readmeContent = await fs2__default.default.readFile(readmePath, "utf-8");
974
+ const markdown = getBadgeMarkdown(badgeType);
975
+ if (readmeContent.includes(markdown) || readmeContent.includes(BADGE_CONFIGS[badgeType].fileName)) {
976
+ console.log(chalk__default.default.gray(" \u2713 Badge already in README.md"));
977
+ return;
978
+ }
979
+ const rl = readline__default.default.createInterface({
980
+ input: process.stdin,
981
+ output: process.stdout
982
+ });
983
+ const answer = await new Promise((resolve) => {
984
+ rl.question(chalk__default.default.cyan(" Add badge to README.md now? (y/n): "), (ans) => {
985
+ rl.close();
986
+ resolve(ans.toLowerCase().trim());
987
+ });
988
+ });
989
+ if (answer === "y" || answer === "yes") {
990
+ await addBadgeToReadme(readmePath, readmeContent, markdown);
991
+ console.log(chalk__default.default.green(" \u2713 Badge added to README.md!"));
992
+ } else {
993
+ console.log(chalk__default.default.gray(" Skipped. You can add it manually anytime."));
994
+ }
995
+ }
996
+ async function addBadgeToReadme(readmePath, content, badge) {
997
+ const lines = content.split("\n");
998
+ let insertIndex = 0;
999
+ for (let i = 0; i < lines.length; i++) {
1000
+ const line = lines[i].trim();
1001
+ if (line.startsWith("[![") || line.startsWith("[!")) {
1002
+ insertIndex = i + 1;
1003
+ continue;
1004
+ }
1005
+ if (insertIndex > 0 && !line.startsWith("[![") && !line.startsWith("[!") && line.length > 0) {
1006
+ break;
1007
+ }
1008
+ if (insertIndex === 0 && line.startsWith("#")) {
1009
+ insertIndex = i + 2;
1010
+ break;
1011
+ }
1012
+ }
1013
+ if (insertIndex === 0) {
1014
+ insertIndex = 1;
1015
+ }
1016
+ lines.splice(insertIndex, 0, badge);
1017
+ await fs2__default.default.writeFile(readmePath, lines.join("\n"), "utf-8");
1018
+ }
1019
+ function displayAllBadges() {
1020
+ console.log(chalk__default.default.cyan("\n\u{1F4CD} Available badges:"));
1021
+ console.log(chalk__default.default.white("\n For audits:"));
1022
+ console.log(chalk__default.default.green(" " + getBadgeMarkdown("audit")));
1023
+ console.log(chalk__default.default.white("\n For component testing:"));
1024
+ console.log(chalk__default.default.green(" " + getBadgeMarkdown("component")));
1025
+ console.log(chalk__default.default.white("\n For both (verified):"));
1026
+ console.log(chalk__default.default.green(" " + getBadgeMarkdown("verified")));
1027
+ console.log("");
1028
+ }
1029
+ var BADGE_CONFIGS;
1030
+ var init_badgeHelper = __esm({
1031
+ "src/utils/cli/badgeHelper.ts"() {
1032
+ BADGE_CONFIGS = {
1033
+ audit: {
1034
+ type: "audit",
1035
+ fileName: "audited-by-aria-ease.svg",
1036
+ label: "Audited by aria-ease",
1037
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/audited-by-aria-ease.svg"
1038
+ },
1039
+ component: {
1040
+ type: "component",
1041
+ fileName: "components-tested-aria-ease.svg",
1042
+ label: "Components tested: aria-ease",
1043
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/components-tested-aria-ease.svg"
1044
+ },
1045
+ verified: {
1046
+ type: "verified",
1047
+ fileName: "verified-by-aria-ease.svg",
1048
+ label: "Verified by aria-ease",
1049
+ markdownUrl: "https://raw.githubusercontent.com/aria-ease/aria-ease/main/package/badges/verified-aria-ease.svg"
1050
+ }
1051
+ };
1052
+ }
1053
+ });
1054
+
938
1055
  // src/utils/test/contract/contractTestRunner.ts
939
1056
  init_contract();
940
1057
  init_ContractReporter();
@@ -1104,16 +1221,31 @@ if (typeof window === "undefined") {
1104
1221
  console.log(`\u{1F680} Running component accessibility tests...
1105
1222
  `);
1106
1223
  const { exec } = await import('child_process');
1224
+ const chalk2 = (await import('chalk')).default;
1107
1225
  exec(
1108
1226
  `npx vitest --run --reporter verbose`,
1109
1227
  { cwd: process.cwd() },
1110
- (error, stdout, stderr) => {
1228
+ async (error, stdout, stderr) => {
1111
1229
  if (stdout) {
1112
1230
  console.log(stdout);
1113
1231
  }
1114
1232
  if (stderr) {
1115
1233
  console.error(stderr);
1116
1234
  }
1235
+ if (!error || error.code === 0) {
1236
+ try {
1237
+ const { displayBadgeInfo: displayBadgeInfo2, promptAddBadge: promptAddBadge2 } = await Promise.resolve().then(() => (init_badgeHelper(), badgeHelper_exports));
1238
+ displayBadgeInfo2("component");
1239
+ await promptAddBadge2("component", process.cwd());
1240
+ console.log(chalk2.dim("\n" + "\u2500".repeat(60)));
1241
+ console.log(chalk2.cyan("\u{1F499} Found aria-ease helpful?"));
1242
+ console.log(chalk2.white(" \u2022 Star us on GitHub: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease"));
1243
+ console.log(chalk2.white(" \u2022 Share feedback: ") + chalk2.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
1244
+ console.log(chalk2.dim("\u2500".repeat(60) + "\n"));
1245
+ } catch (badgeError) {
1246
+ console.error("Warning: Could not display badge prompt:", badgeError);
1247
+ }
1248
+ }
1117
1249
  if (error && error.code) {
1118
1250
  process.exit(error.code);
1119
1251
  }
@@ -167,16 +167,31 @@ if (typeof window === "undefined") {
167
167
  console.log(`\u{1F680} Running component accessibility tests...
168
168
  `);
169
169
  const { exec } = await import('child_process');
170
+ const chalk = (await import('chalk')).default;
170
171
  exec(
171
172
  `npx vitest --run --reporter verbose`,
172
173
  { cwd: process.cwd() },
173
- (error, stdout, stderr) => {
174
+ async (error, stdout, stderr) => {
174
175
  if (stdout) {
175
176
  console.log(stdout);
176
177
  }
177
178
  if (stderr) {
178
179
  console.error(stderr);
179
180
  }
181
+ if (!error || error.code === 0) {
182
+ try {
183
+ const { displayBadgeInfo, promptAddBadge } = await import('./badgeHelper-Y4SEXT4W.js');
184
+ displayBadgeInfo("component");
185
+ await promptAddBadge("component", process.cwd());
186
+ console.log(chalk.dim("\n" + "\u2500".repeat(60)));
187
+ console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
188
+ console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
189
+ console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
190
+ console.log(chalk.dim("\u2500".repeat(60) + "\n"));
191
+ } catch (badgeError) {
192
+ console.error("Warning: Could not display badge prompt:", badgeError);
193
+ }
194
+ }
180
195
  if (error && error.code) {
181
196
  process.exit(error.code);
182
197
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aria-ease",
3
- "version": "6.3.1",
3
+ "version": "6.4.0",
4
4
  "description": "Out-of-the-box accessibility utility package to develop production ready applications.",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",