@holmdigital/engine 1.4.9 → 1.4.11

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
@@ -51,7 +51,14 @@ npx hd-a11y-scan <url> [options]
51
51
  | `--generate-tests` | Generate Pseudo-Automation tests |
52
52
  | `--invalid-https-cert` | Allow scanning sites with invalid/self-signed HTTPS certificates ⚠️ |
53
53
  | `--api-key <key>` | API Key for HolmDigital Cloud |
54
- | `--cloud-url <url>` | Custom URL for HolmDigital Cloud API |
54
+ | `--cloud-url <url>` | Custom Cloud API Endpoint (default: cloud.holmdigital.se) |
55
+
56
+ ### 🏆 Accessibility Badge
57
+ If your site achieves a **100% score**, the CLI will generate a [Shields.io](https://shields.io/) badge that you can add to your project's README:
58
+
59
+ ![Accessibility Status: 100% Compliant](https://img.shields.io/badge/HolmDigital_Engine-100%25-00703C?style=flat-square)
60
+
61
+ The badge uses accessible colors (AAA compliant contrast) and is included in both the CLI output and the HTML report.
55
62
 
56
63
  > **⚠️ Security Note:** The `--invalid-https-cert` flag should only be used in trusted environments (local dev, staging). It disables certificate validation and is not recommended for production. *(Contributed by [@FerdiStro](https://github.com/FerdiStro))*
57
64
 
package/dist/cli/index.js CHANGED
@@ -795,6 +795,23 @@ test('${testName}', async ({ page }) => {
795
795
  }
796
796
  };
797
797
 
798
+ // src/reporting/badge-generator.ts
799
+ var BADGE_COLOR = "00703C";
800
+ var BADGE_BASE_URL = "https://img.shields.io/badge/HolmDigital_Engine";
801
+ function generateBadgeUrl(score) {
802
+ if (score !== 100) {
803
+ return null;
804
+ }
805
+ return `${BADGE_BASE_URL}-100%25-${BADGE_COLOR}?style=flat-square`;
806
+ }
807
+ function generateBadgeMarkdown(score) {
808
+ const url = generateBadgeUrl(score);
809
+ if (!url) {
810
+ return null;
811
+ }
812
+ return `![Accessibility Status: 100% Compliant](${url})`;
813
+ }
814
+
798
815
  // src/reporting/html-template.ts
799
816
  init_i18n();
800
817
  function generateReportHTML(result) {
@@ -958,6 +975,7 @@ function generateReportHTML(result) {
958
975
  <div class="meta">
959
976
  <div>${t("report.scan_target", { url: result.url })}</div>
960
977
  <div>${t("report.generated", { date: formatDate(result.timestamp) })}</div>
978
+ ${generateBadgeUrl(result.score) ? `<div style="margin-top: 0.5rem;"><img src="${generateBadgeUrl(result.score)}" alt="Accessibility Status: 100% Compliant" /></div>` : ""}
961
979
  </div>
962
980
  </div>
963
981
 
@@ -1198,6 +1216,13 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
1198
1216
  if (result.complianceStatus === "FAIL") {
1199
1217
  console.log(import_chalk.default.red(t("cli.not_compliant")));
1200
1218
  }
1219
+ if (result.score === 100) {
1220
+ const badge = generateBadgeMarkdown(result.score);
1221
+ if (badge) {
1222
+ console.log(import_chalk.default.green.bold("\n\u{1F3C6} Perfect Score! Here is your accessibility badge:"));
1223
+ console.log(import_chalk.default.white(badge));
1224
+ }
1225
+ }
1201
1226
  console.log(import_chalk.default.gray("----------------------------------------"));
1202
1227
  if (options.viewport) {
1203
1228
  console.log(import_chalk.default.blue(t("cli.viewport", { width: viewport.width, height: viewport.height })));
@@ -14,6 +14,23 @@ import { Command } from "commander";
14
14
  import chalk from "chalk";
15
15
  import ora from "ora";
16
16
 
17
+ // src/reporting/badge-generator.ts
18
+ var BADGE_COLOR = "00703C";
19
+ var BADGE_BASE_URL = "https://img.shields.io/badge/HolmDigital_Engine";
20
+ function generateBadgeUrl(score) {
21
+ if (score !== 100) {
22
+ return null;
23
+ }
24
+ return `${BADGE_BASE_URL}-100%25-${BADGE_COLOR}?style=flat-square`;
25
+ }
26
+ function generateBadgeMarkdown(score) {
27
+ const url = generateBadgeUrl(score);
28
+ if (!url) {
29
+ return null;
30
+ }
31
+ return `![Accessibility Status: 100% Compliant](${url})`;
32
+ }
33
+
17
34
  // src/reporting/html-template.ts
18
35
  function generateReportHTML(result) {
19
36
  const criticalCount = result.stats.critical;
@@ -176,6 +193,7 @@ function generateReportHTML(result) {
176
193
  <div class="meta">
177
194
  <div>${t("report.scan_target", { url: result.url })}</div>
178
195
  <div>${t("report.generated", { date: formatDate(result.timestamp) })}</div>
196
+ ${generateBadgeUrl(result.score) ? `<div style="margin-top: 0.5rem;"><img src="${generateBadgeUrl(result.score)}" alt="Accessibility Status: 100% Compliant" /></div>` : ""}
179
197
  </div>
180
198
  </div>
181
199
 
@@ -413,6 +431,13 @@ program.argument("<url>", "URL to scan").option("--lang <code>", "Language code
413
431
  if (result.complianceStatus === "FAIL") {
414
432
  console.log(chalk.red(t("cli.not_compliant")));
415
433
  }
434
+ if (result.score === 100) {
435
+ const badge = generateBadgeMarkdown(result.score);
436
+ if (badge) {
437
+ console.log(chalk.green.bold("\n\u{1F3C6} Perfect Score! Here is your accessibility badge:"));
438
+ console.log(chalk.white(badge));
439
+ }
440
+ }
416
441
  console.log(chalk.gray("----------------------------------------"));
417
442
  if (options.viewport) {
418
443
  console.log(chalk.blue(t("cli.viewport", { width: viewport.width, height: viewport.height })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holmdigital/engine",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -76,4 +76,4 @@
76
76
  "typescript": "^5.7.2",
77
77
  "vitest": "^4.0.16"
78
78
  }
79
- }
79
+ }