fix(release): format generated UI references before verification

This commit is contained in:
2026-08-01 07:14:45 +05:30
parent 2b06b00d35
commit c54144f2e4
+7 -7
View File
@@ -230,11 +230,11 @@ function verifyUiComponentReference(): void {
throw new Error(`Failed to generate the UI component reference.${detail ? `\n${detail}` : ""}`);
}
// Do not use `git status --short` here. On Windows, the generator writes LF
// while an autocrlf checkout may contain CRLF. `git status` can report those
// files as modified even when their canonical Git content is identical.
// `git diff --quiet` applies Git's normal text conversion and only fails for
// a real generated-content difference.
// Format generated files before comparing them with Git.
// The generator expands JSON arrays, while Prettier may place short arrays
// on one line. Comparing before formatting creates a permanent false diff.
run(process.execPath, ["x", "prettier", "--write", ...generatedFiles], root);
const changedStatus = run("git", ["diff", "--quiet", "--", ...generatedFiles], root, {
capture: true,
allowFailure: true,
@@ -254,9 +254,9 @@ function verifyUiComponentReference(): void {
"",
"Run:",
" bun run scripts/generate-ui-component-reference.mjs",
" bun run format",
" bunx prettier --write packages/ui/component-catalog.json packages/ui/component-reference.json packages/ui/COMPONENTS.md",
" git add packages/ui/component-catalog.json packages/ui/component-reference.json packages/ui/COMPONENTS.md",
' git commit -m "docs(ui): refresh component reference"',
' git commit -m \\"docs(ui): refresh component reference\\"',
" git push origin main",
].join("\n"),
);