eaa-kit 0.1.0 → 0.1.1

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
@@ -22,8 +22,9 @@ npx eaa-kit statement # Barrierefreiheitserklärung from eaa.config
22
22
  pnpm add -D eaa-kit # npm i -D eaa-kit
23
23
  ```
24
24
 
25
- Node 22.22 or newer. jsdom, which the browserless engine is built on, does not support
26
- Node 20.
25
+ Node 22.22, 24.15 or 26 and newer. jsdom, which the browserless engine is built on,
26
+ supports only the even-numbered release lines, so the odd-numbered ones (23, 25) are not
27
+ supported here either.
27
28
 
28
29
  ## What it does
29
30
 
@@ -18,7 +18,7 @@ function eaaKit(options = {}) {
18
18
  logger.info("skipped (enabled: false)");
19
19
  return;
20
20
  }
21
- const { runAuditCommand } = await import("../audit-VtuUOuyX.js");
21
+ const { runAuditCommand } = await import("../audit-47fMewVm.js");
22
22
  const { exitCode } = await runAuditCommand(fileURLToPath(dir), {
23
23
  ...options.failOn ? { failOn: options.failOn } : {},
24
24
  ...options.include ? { include: options.include } : {},
@@ -0,0 +1,2 @@
1
+ import { r as runAuditCommand } from "./audit-CApiPaiG.js";
2
+ export { runAuditCommand };
@@ -69,6 +69,30 @@ async function readPage(root, relativePath) {
69
69
  function toPosix(filePath) {
70
70
  return filePath.split(path.sep).join("/");
71
71
  }
72
+ /**
73
+ * What to suggest when a directory exists but holds no HTML.
74
+ *
75
+ * Nearly always the wrong directory rather than a site with no pages, and the
76
+ * commonest way to arrive here is a framework whose build does not emit browsable
77
+ * HTML at all. Naming the one in front of the user beats a generic "check the
78
+ * path", so the project is sniffed for the frameworks that mislead people this
79
+ * way — `./dist` is every tutorial's answer and is wrong for all of them.
80
+ */
81
+ async function emptyDirectoryHint(dir, cwd = process.cwd()) {
82
+ const has = async (name) => {
83
+ try {
84
+ await stat(path.resolve(cwd, name));
85
+ return true;
86
+ } catch {
87
+ return false;
88
+ }
89
+ };
90
+ if (await has("next.config.js") || await has("next.config.mjs") || await has("next.config.ts")) return `${dir} holds no HTML, and a Next.js build does not put any there.\n Static export writes to out/: set output: 'export' in next.config, run next build,
91
+ then: eaa-kit audit ./out
92
+ A site with SSR, API routes or middleware cannot be exported this way.`;
93
+ if (await has("nuxt.config.ts")) return `${dir} holds no HTML. Nuxt writes a static build to .output/public — try: eaa-kit audit ./.output/public`;
94
+ return `${dir} holds no HTML. Point eaa-kit at the directory your build fills with .html files\n — commonly dist/, build/, out/ or _site/, depending on the builder.`;
95
+ }
72
96
  //#endregion
73
97
  //#region src/audit/report/console.ts
74
98
  const DEFAULT_MAX_NODES = 3;
@@ -436,7 +460,7 @@ async function runAuditCommand(dir, options = {}) {
436
460
  throw cause;
437
461
  }
438
462
  if (pages.length === 0) {
439
- process.stderr.write(`${pc.yellow("warning")} No HTML files found in ${dir}\n`);
463
+ process.stderr.write(`${pc.yellow("warning")} ${await emptyDirectoryHint(dir, options.cwd ?? process.cwd())}\n`);
440
464
  return {
441
465
  audits: [],
442
466
  exitCode: 2
@@ -579,4 +603,4 @@ async function renderReport(audits, dir, failOn, format, toFile, options) {
579
603
  }
580
604
  }
581
605
  //#endregion
582
- export { collectPages as a, BuildDirectoryError as i, isOutputFormat as n, runAuditCommand as r, OUTPUT_FORMATS as t };
606
+ export { collectPages as a, BuildDirectoryError as i, isOutputFormat as n, emptyDirectoryHint as o, runAuditCommand as r, OUTPUT_FORMATS as t };
package/dist/cli/index.js CHANGED
@@ -3,7 +3,7 @@ import { f as COUNTRIES, h as STATEMENT_LOCALES, i as readAuditReport, l as load
3
3
  import { i as isImpactLevel, n as IMPACT_LEVELS, t as DEFAULT_FAIL_ON } from "../impact-DvgBjupx.js";
4
4
  import { t as TOOL_VERSION } from "../version-B3v4rNoG.js";
5
5
  import { i as buildBaseline, n as DEFAULT_BASELINE_FILE, s as writeBaseline, t as BaselineError } from "../baseline-DQTnNlc4.js";
6
- import { a as collectPages, i as BuildDirectoryError, n as isOutputFormat, r as runAuditCommand, t as OUTPUT_FORMATS } from "../audit-6gbV0Zjd.js";
6
+ import { a as collectPages, i as BuildDirectoryError, n as isOutputFormat, o as emptyDirectoryHint, r as runAuditCommand, t as OUTPUT_FORMATS } from "../audit-CApiPaiG.js";
7
7
  import { mkdir, writeFile } from "node:fs/promises";
8
8
  import path from "node:path";
9
9
  import { Command, InvalidArgumentError } from "commander";
@@ -40,7 +40,7 @@ async function runBaselineCommand(dir, options = {}) {
40
40
  throw cause;
41
41
  }
42
42
  if (pages.length === 0) {
43
- process.stderr.write(`${pc.yellow("warning")} No HTML files found in ${dir}\n`);
43
+ process.stderr.write(`${pc.yellow("warning")} ${await emptyDirectoryHint(dir, options.cwd ?? process.cwd())}\n`);
44
44
  return {
45
45
  entries: 0,
46
46
  exitCode: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eaa-kit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Build-time WCAG 2.2 AA auditor and EU accessibility statement generator for static sites (EAA / BFSG / BaFG, DACH-localised).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "cli"
24
24
  ],
25
25
  "engines": {
26
- "node": ">=22.22.2"
26
+ "node": "^22.22.2 || ^24.15.0 || >=26.0.0"
27
27
  },
28
28
  "packageManager": "pnpm@10.28.0",
29
29
  "bin": {
@@ -53,7 +53,7 @@
53
53
  "typecheck": "tsc --noEmit",
54
54
  "lint": "biome check .",
55
55
  "format": "biome check --write .",
56
- "smoke": "pnpm build && node dist/cli/index.js audit tests/fixtures/site --include about/** --format json && node dist/cli/index.js audit tests/fixtures/site --include 'about/**' 'blog/**' 'drafts/**' 'legacy.htm' --concurrency 2 && node dist/cli/index.js audit tests/fixtures/site --include about/** --format html && node dist/cli/index.js audit tests/fixtures/site --baseline examples/baseline.json && node -e \"import('./dist/astro/index.js').then(m => { const i = m.default(); if (i.name !== 'eaa-kit' || typeof i.hooks['astro:build:done'] !== 'function') { throw new Error('astro entry point is not an integration') } console.log('astro entry ok') })\" && node dist/cli/index.js statement --config examples/eaa.config.json && node dist/cli/index.js statement --config examples/eaa.config.json --audit examples/report.json --format html",
56
+ "smoke": "pnpm build && node dist/cli/index.js audit tests/fixtures/site --include about/** --format json && node dist/cli/index.js audit tests/fixtures/site --include \"about/**\" \"blog/**\" \"drafts/**\" \"legacy.htm\" --concurrency 2 && node dist/cli/index.js audit tests/fixtures/site --include about/** --format html && node dist/cli/index.js audit tests/fixtures/site --baseline examples/baseline.json && node -e \"import('./dist/astro/index.js').then(m => { const i = m.default(); if (i.name !== 'eaa-kit' || typeof i.hooks['astro:build:done'] !== 'function') { throw new Error('astro entry point is not an integration') } console.log('astro entry ok') })\" && node dist/cli/index.js statement --config examples/eaa.config.json && node dist/cli/index.js statement --config examples/eaa.config.json --audit examples/report.json --format html",
57
57
  "examples": "pnpm build && node scripts/generate-examples.mjs"
58
58
  },
59
59
  "peerDependencies": {
@@ -1,2 +0,0 @@
1
- import { r as runAuditCommand } from "./audit-6gbV0Zjd.js";
2
- export { runAuditCommand };