fix(ci): the metadata gate failed over a missing newline, on every commit
`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.
This commit is contained in:
parent
7d35fa842b
commit
ca427db8ac
|
|
@ -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}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue