create-website-build-kit 0.1.18 → 0.1.20

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.
@@ -52,6 +52,7 @@
52
52
  "@astrojs/check": "^0.9.10",
53
53
  "@cloudflare/workers-types": "^5.20260815.1",
54
54
  "pa11y-ci": "^4.1.1",
55
+ "puppeteer": "^24.43.1",
55
56
  "sharp": "^0.35.3",
56
57
  "turndown": "^7.2.4",
57
58
  "typescript": "^6.0.3",
@@ -33,7 +33,7 @@ import { tmpdir } from 'node:os';
33
33
  import { join } from 'node:path';
34
34
  import { createRequire } from 'node:module';
35
35
 
36
- import { SCHEMES, configForScheme } from './lib/schemes.mjs';
36
+ import { SCHEMES, assertForced, configForScheme } from './lib/schemes.mjs';
37
37
 
38
38
  const require = createRequire(import.meta.url);
39
39
 
@@ -103,10 +103,22 @@ const runScheme = (scheme) => {
103
103
  const file = join(tmp, `${scheme}.json`);
104
104
  writeFileSync(file, JSON.stringify(configForScheme(config, scheme), null, 2));
105
105
 
106
- /* --config supplies the forced-scheme defaults either way; --sitemap only
107
- replaces where the URL list comes from. */
106
+ /*
107
+ * --config supplies the forced-scheme defaults either way; --sitemap only
108
+ * replaces where the URL list comes from.
109
+ *
110
+ * ⚠ NO `--standard` HERE. That is a `pa11y` option, not a `pa11y-ci` one, and
111
+ * passing it made the CLI exit immediately with `unknown option
112
+ * '--standard'` — which this function reports as "pa11y-ci could not run.
113
+ * Start the site first", pointing at the wrong problem entirely. So the
114
+ * documented way to produce a pack against a DEPLOYED host had never once
115
+ * worked; it was the form nobody ran, because the only excuse for not
116
+ * testing this script was that it needed a deployment. The standard reaches
117
+ * pa11y through `defaults.standard` in the config, which is where the
118
+ * no-host form has always read it from.
119
+ */
108
120
  const args = host
109
- ? ['pa11y-ci', '--config', file, '--sitemap', `${host}/sitemap-index.xml`, '--standard', standard, '--json']
121
+ ? ['pa11y-ci', '--config', file, '--sitemap', `${host}/sitemap-index.xml`, '--json']
110
122
  : ['pa11y-ci', '--config', file, '--json'];
111
123
 
112
124
  try {
@@ -130,6 +142,21 @@ const runScheme = (scheme) => {
130
142
  }
131
143
  };
132
144
 
145
+ /*
146
+ * ⚠ THE SAME PROOF check-a11y MAKES, AND IT MATTERS MORE HERE. This file
147
+ * writes a dated document stating which schemes were measured. Under the
148
+ * flag that did nothing, that document was wrong in writing — an evidence
149
+ * pack asserting a dark-palette pass that never happened. Refuse rather than
150
+ * write it.
151
+ */
152
+ for (const scheme of SCHEMES) {
153
+ const why = await assertForced(scheme);
154
+ if (why) {
155
+ console.error(`${RED}✗${RESET} ${why}\n`);
156
+ process.exit(1);
157
+ }
158
+ }
159
+
133
160
  const passes = SCHEMES.map((scheme) => {
134
161
  const report = runScheme(scheme);
135
162
  const rows = Object.entries(report.results).map(([url, issues]) => ({
@@ -20,7 +20,7 @@ import { existsSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
20
20
  import { tmpdir } from 'node:os';
21
21
  import { join } from 'node:path';
22
22
 
23
- import { SCHEMES, configForScheme } from './lib/schemes.mjs';
23
+ import { SCHEMES, assertForced, configForScheme } from './lib/schemes.mjs';
24
24
 
25
25
  const RESET = '\x1b[0m';
26
26
  const RED = '\x1b[31m';
@@ -51,6 +51,21 @@ if (!schemes.length) {
51
51
  process.exit(1);
52
52
  }
53
53
 
54
+ /*
55
+ * ⚠ PROVE THE SCHEME FORCING WORKS BEFORE MEASURING ANYTHING. The previous
56
+ * flag was one Chrome silently ignores, so this loop ran twice against the
57
+ * machine's own palette and reported "clean in light and dark". Refusing here
58
+ * costs one Chrome launch per scheme and is the only thing standing between
59
+ * that sentence and the truth. See scripts/lib/schemes.mjs.
60
+ */
61
+ for (const scheme of schemes) {
62
+ const why = await assertForced(scheme);
63
+ if (why) {
64
+ console.error(`${RED}✗${RESET} ${why}\n`);
65
+ process.exit(1);
66
+ }
67
+ }
68
+
54
69
  const base = JSON.parse(readFileSync(CONFIG, 'utf8'));
55
70
  const urlCount = (base.urls ?? []).length;
56
71
  const dir = mkdtempSync(join(tmpdir(), 'a11y-'));