Skip to content

Commit 652ae58

Browse files
committed
fix(release): self-format generated reference-seeds + lint after generation
The 60-seed corpus generator emitted JSON.stringify(null,2) (2-space) output, but the repo biome config enforces 4-space — and release.sh runs lint BEFORE regenerating the seeds, so the unformatted generated file only failed in CI after the tag was cut (v0.22.0 publish blocked at Test(plugin) lint). - build-reference-seeds.ts now runs 'biome check --write' on its output with cwd=plugin root (biome resolves config+scope from cwd; the script is invoked from repo root by release.sh where the generated path is otherwise out of biome's include set). - release.sh re-lints the plugin after schema+seed generation as defense-in-depth so generator drift fails locally, not in CI.
1 parent 4e57537 commit 652ae58

3 files changed

Lines changed: 273 additions & 244 deletions

File tree

packages/plugin/scripts/build-reference-seeds.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Regenerate after editing the source corpus:
1414
* bun run packages/plugin/scripts/build-reference-seeds.ts
1515
*/
16+
import { spawnSync } from "node:child_process";
1617
import { readFileSync, writeFileSync } from "node:fs";
1718
import { dirname, resolve } from "node:path";
1819
import { fileURLToPath } from "node:url";
@@ -74,6 +75,26 @@ export const REFERENCE_SEEDS: ReadonlyArray<ReferenceSeed> = ${JSON.stringify(se
7475
`;
7576

7677
writeFileSync(OUT, header, "utf-8");
78+
79+
// Format the emitted file with biome so it matches repo style (4-space indent).
80+
// The template above is hand-indented 2-space and JSON.stringify uses 2-space;
81+
// without this, the generated file fails the lint gate. release.sh lints BEFORE
82+
// regenerating, so an unformatted emit would otherwise only surface in CI.
83+
// biome resolves its config + include scope from cwd, so run it with cwd set to
84+
// the plugin package root (where biome.json lives and src/** is in scope) — the
85+
// script may be invoked from the repo root (e.g. release.sh) where the plugin's
86+
// generated path is not in biome's include set and the format would be a no-op.
87+
const pluginRoot = resolve(here, "..");
88+
const fmt = spawnSync("bunx", ["biome", "check", "--write", OUT], {
89+
cwd: pluginRoot,
90+
stdio: "ignore",
91+
});
92+
if (fmt.status !== 0) {
93+
console.warn(
94+
`build-reference-seeds: biome format step exited ${fmt.status ?? "null"} (continuing; lint gate will catch any issue)`,
95+
);
96+
}
97+
7798
console.log(
7899
`build-reference-seeds: emitted ${seeds.length} seeds (importance ${Math.min(
79100
...seeds.map((s) => s.importance),

0 commit comments

Comments
 (0)