fix(release): stabilize generated UI references
This commit is contained in:
@@ -7,8 +7,22 @@ const catalogPath = join(uiRoot, "component-catalog.json");
|
||||
const catalog = JSON.parse(readFileSync(catalogPath, "utf8"));
|
||||
const metadata = new Map(catalog.components.map((entry) => [entry.name, entry]));
|
||||
|
||||
function normalizeNewlines(source) {
|
||||
return source.replace(/\r\n?/g, "\n");
|
||||
}
|
||||
|
||||
async function writeFormatted(path, source) {
|
||||
const current = readFileSync(path, "utf8");
|
||||
|
||||
// Do not rewrite a generated file when only its working-tree line endings
|
||||
// differ. This keeps release verification clean on Windows CRLF checkouts
|
||||
// while still rewriting files whose generated content is genuinely stale.
|
||||
if (normalizeNewlines(current) === normalizeNewlines(source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
writeFileSync(path, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
function block(source, keyword) {
|
||||
|
||||
Reference in New Issue
Block a user