From 75427c7cdd3612a3cc2b23c9303e9be8dedc9bf2 Mon Sep 17 00:00:00 2001 From: Cole Medin Date: Thu, 16 Apr 2026 17:55:24 -0500 Subject: [PATCH] fix(ci): normalize line endings in bundled-defaults generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows, `git checkout` converts source files to CRLF via the `* text=auto` policy. The generator inlined raw file content as JSON strings, so the Windows regeneration produced `\r\n` escapes while the committed artifact (written on Linux) used `\n`. `bun run check:bundled` then flagged the file as stale and failed the Windows CI job. Fix by normalizing CRLF → LF both when reading source defaults and when comparing against the existing generated file. No-op on Linux. Co-Authored-By: Claude Opus 4.7 --- scripts/generate-bundled-defaults.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/generate-bundled-defaults.ts b/scripts/generate-bundled-defaults.ts index afd941cc..1abcea74 100644 --- a/scripts/generate-bundled-defaults.ts +++ b/scripts/generate-bundled-defaults.ts @@ -79,7 +79,10 @@ async function collectFiles(dir: string, extensions: readonly string[]): Promise ); } seen.add(name); - const content = await readFile(join(dir, entry), 'utf-8'); + const raw = await readFile(join(dir, entry), 'utf-8'); + // Normalize to LF so output is identical regardless of the checkout's + // line-ending policy (e.g. Windows `core.autocrlf=true` yields CRLF). + const content = raw.replace(/\r\n/g, '\n'); if (!content.trim()) { throw new Error(`Bundled default "${entry}" in ${dir} is empty.`); } @@ -144,7 +147,10 @@ async function main(): Promise { if (CHECK_ONLY) { let existing = ''; try { - existing = await readFile(OUTPUT_PATH, 'utf-8'); + const raw = await readFile(OUTPUT_PATH, 'utf-8'); + // Same LF normalization as collectFiles — the .ts itself may be + // checked out with CRLF line endings on Windows. + existing = raw.replace(/\r\n/g, '\n'); } catch (e) { const err = e as NodeJS.ErrnoException; if (err.code !== 'ENOENT') throw err;