From ca427db8ac69e8ebb9ea4d0c8cfbb6fd8f9da16c Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 25 Aug 2026 02:36:06 +0200 Subject: [PATCH] fix(ci): the metadata gate failed over a missing newline, on every commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Fail if components-metadata.json is out of date` has been red on every push for days. The diff it printed was one line — the last one: -} +} \ No newline at end of file The committed JSON ends with a newline; the generator wrote JSON.stringify(...) with none, so `git diff` was never empty and no content change could ever clear it. The generator now writes the trailing newline, which makes a fresh run byte-identical to what is committed. Verified by running the real generator (needs the wokwi-elements clone, and NODE_PATH pointing at frontend/node_modules): 156 components, `git diff` empty. --- scripts/generate-component-metadata.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/generate-component-metadata.ts b/scripts/generate-component-metadata.ts index 4a858f33..da49afff 100644 --- a/scripts/generate-component-metadata.ts +++ b/scripts/generate-component-metadata.ts @@ -165,7 +165,11 @@ class MetadataGenerator { fs.mkdirSync(outputDir, { recursive: true }); } - fs.writeFileSync(this.outputPath, JSON.stringify(output, null, 2)); + // Trailing newline, deliberately: CI regenerates this file and fails the + // build when `git diff` is not empty. Without it every run reported the + // committed JSON as stale over the last byte alone — a red X on every + // commit that no content change could ever clear. + fs.writeFileSync(this.outputPath, `${JSON.stringify(output, null, 2)}\n`); console.log(`\nāœ… Generated metadata for ${components.length} components`); console.log(`šŸ“„ Output: ${this.outputPath}`); }