@geonosis/walk 1.2.0 → 1.3.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.
|
@@ -594,6 +594,22 @@ var WALK_DEFAULT = {
|
|
|
594
594
|
viewport: VIEWPORT
|
|
595
595
|
};
|
|
596
596
|
var KNOWN = /* @__PURE__ */ new Set(["options", "probes", "report", "urls", "viewport"]);
|
|
597
|
+
var ABOUT = {
|
|
598
|
+
options: "object? keyed by probe id; each probe validates its own",
|
|
599
|
+
probes: "string[]? the probe ids to run",
|
|
600
|
+
report: "string? where the JSON report is written",
|
|
601
|
+
urls: "string[]? the pages to walk",
|
|
602
|
+
viewport: 'object? { "width": <number>, "height": <number> }'
|
|
603
|
+
};
|
|
604
|
+
var configShape = () => [
|
|
605
|
+
"geonosis-walk reads geonosis.json",
|
|
606
|
+
"",
|
|
607
|
+
'geonosis.json \u2192 "walk" every key optional, every default a contract',
|
|
608
|
+
...[...KNOWN].toSorted().map((key) => ` ${key.padEnd(11)}${ABOUT[key] ?? ""}`),
|
|
609
|
+
"",
|
|
610
|
+
"A key outside this list is REFUSED by name: a misspelling accepted in silence is a probe nobody",
|
|
611
|
+
"is running against a page nobody is walking."
|
|
612
|
+
].join("\n");
|
|
597
613
|
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
598
614
|
var readViewport = (value) => {
|
|
599
615
|
if (value === void 0) return VIEWPORT;
|
|
@@ -735,6 +751,7 @@ export {
|
|
|
735
751
|
DEFAULT_PROBES,
|
|
736
752
|
WALK_REPORT,
|
|
737
753
|
WALK_DEFAULT,
|
|
754
|
+
configShape,
|
|
738
755
|
parseViewport,
|
|
739
756
|
loadWalkConfig,
|
|
740
757
|
configPath,
|
package/dist/index.js
CHANGED
package/dist/walk-cli.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WalkError,
|
|
3
3
|
configPath,
|
|
4
|
+
configShape,
|
|
4
5
|
findingsIn,
|
|
5
6
|
loadWalkConfig,
|
|
6
7
|
parseViewport,
|
|
7
8
|
probeById,
|
|
8
9
|
walk
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KB2R6USR.js";
|
|
10
11
|
|
|
11
12
|
// src/walk-cli.ts
|
|
12
13
|
import { mkdirSync, writeFileSync } from "fs";
|
|
@@ -26,11 +27,26 @@ var parse = (argv) => {
|
|
|
26
27
|
else if (arg === "--report") out.report = takes("--report");
|
|
27
28
|
else if (arg === "--viewport") out.viewport = takes("--viewport");
|
|
28
29
|
else if (arg === "--probe") out.probes.push(takes("--probe"));
|
|
29
|
-
else if (arg.startsWith("-"))
|
|
30
|
+
else if (arg.startsWith("-"))
|
|
31
|
+
throw new WalkError(`unknown option ${arg} \u2014 run geonosis-walk --help`);
|
|
30
32
|
else out.urls.push(arg);
|
|
31
33
|
}
|
|
32
34
|
return out;
|
|
33
35
|
};
|
|
36
|
+
var USAGE = `geonosis-walk [url\u2026] [--config <geonosis.json>] [--probe <id>] [--viewport <WxH>] [--report <path>]
|
|
37
|
+
|
|
38
|
+
Walks the URLs this repo declares and runs the accessibility, correctness and dead-end probes
|
|
39
|
+
against each. URLs and probes named on the command line replace the configured ones.
|
|
40
|
+
|
|
41
|
+
--config <path> the geonosis.json holding the \`walk\` block (default: the working directory's)
|
|
42
|
+
--probe <id> run this probe (repeatable); default: the probes the config names
|
|
43
|
+
--viewport <WxH> the viewport to render at, e.g. 1280x800
|
|
44
|
+
--report <path> where the JSON report is written (default: the config's)
|
|
45
|
+
--help, -h this text
|
|
46
|
+
|
|
47
|
+
Exit codes: 0 the walk ran and found nothing \xB7 1 the walk ran and found something \xB7 2 the walk did
|
|
48
|
+
not run. The report is written for 0 and 1, and never for 2 \u2014 a tool that reported an empty result
|
|
49
|
+
for a browser it could not launch would pass hardest exactly when it is broken.`;
|
|
34
50
|
var line = (finding) => `${finding.severity} ${finding.class} ${finding.url}${finding.selector === void 0 ? "" : ` ${finding.selector}`}
|
|
35
51
|
${finding.evidence}`;
|
|
36
52
|
var summarise = (report) => [
|
|
@@ -40,7 +56,18 @@ var summarise = (report) => [
|
|
|
40
56
|
`${report.pages.length} page(s), ${findingsIn(report)} finding(s)`
|
|
41
57
|
].join("\n");
|
|
42
58
|
var main = async () => {
|
|
43
|
-
const
|
|
59
|
+
const args = process.argv.slice(2);
|
|
60
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
61
|
+
process.stdout.write(`${USAGE}
|
|
62
|
+
`);
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
if (args.includes("--print-config-shape")) {
|
|
66
|
+
process.stdout.write(`${configShape()}
|
|
67
|
+
`);
|
|
68
|
+
return 0;
|
|
69
|
+
}
|
|
70
|
+
const argv = parse(args);
|
|
44
71
|
const cwd = process.cwd();
|
|
45
72
|
const config = loadWalkConfig(configPath(cwd, argv.config));
|
|
46
73
|
const ids = argv.probes.length > 0 ? argv.probes : config.probes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geonosis/walk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"description": "The customer walk as a gate: eight computed-DOM probes over a list of URLs, one JSON report, and an exit code that tells a could-not-run from a clean page.",
|
|
6
6
|
"keywords": [
|