mirror of
https://github.com/coleam00/Archon
synced 2026-04-21 13:37:41 +00:00
fix(ci): normalize line endings in bundled-defaults generator
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 <noreply@anthropic.com>
This commit is contained in:
parent
b7b445bd31
commit
75427c7cdd
1 changed files with 8 additions and 2 deletions
|
|
@ -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<void> {
|
|||
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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue