Skip to content

Commit 018be75

Browse files
committed
fix(showcase/scripts): loadDocsLinks parse failures surface via allErrors
A malformed docs-links.json was only console.warn'd and treated as empty — build ran green while the override file silently rotted. Accept an errors accumulator and push parse failures into it so main()'s non-zero exit path fires. Missing file and stale-shape tolerance are unchanged (both are legitimate states).
1 parent 3326b3c commit 018be75

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

showcase/scripts/generate-registry.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,15 @@ type DocsLinks = {
5959
*
6060
* Missing file -> empty overrides. A file with the older shape (e.g. using
6161
* `shell_docs_url` instead of `shell_docs_path`) is treated as stale: we
62-
* still merge what we can without erroring. Completely malformed JSON is
63-
* logged and treated as empty.
62+
* still merge what we can without erroring.
63+
*
64+
* A completely malformed JSON file IS a build-blocking error: the caller
65+
* must pass `errors` so the failure surfaces in the aggregated error list
66+
* and `main()`'s `process.exit(1)` path fires. Previously we just
67+
* `console.warn`ed, which let CI continue green with a silently broken
68+
* override file on disk.
6469
*/
65-
function loadDocsLinks(packageDir: string): DocsLinks {
70+
function loadDocsLinks(packageDir: string, errors: string[]): DocsLinks {
6671
const docsLinksPath = path.join(packageDir, "docs-links.json");
6772
if (!fs.existsSync(docsLinksPath)) {
6873
return { features: {} };
@@ -95,8 +100,8 @@ function loadDocsLinks(packageDir: string): DocsLinks {
95100
}
96101
return { features };
97102
} catch (e) {
98-
console.warn(
99-
` WARN: failed to parse ${docsLinksPath}, treating as empty: ${e}`,
103+
errors.push(
104+
`${docsLinksPath}: failed to parse docs-links.json: ${(e as Error).message}`,
100105
);
101106
return { features: {} };
102107
}
@@ -214,7 +219,7 @@ function main() {
214219
// Best-effort: missing file or stale shapes are tolerated and don't error.
215220
for (const manifest of integrations) {
216221
const pkgDir = path.join(PACKAGES_DIR, manifest.slug as string);
217-
manifest.docs_links = loadDocsLinks(pkgDir);
222+
manifest.docs_links = loadDocsLinks(pkgDir, allErrors);
218223
}
219224

220225
// Constraint validation

0 commit comments

Comments
 (0)