fix(release): point locale drift at generated sync

This commit is contained in:
Peter Steinberger
2026-07-17 12:15:58 +01:00
parent c149489703
commit 6f3aa0f7ae
2 changed files with 17 additions and 6 deletions
+8 -6
View File
@@ -28,6 +28,13 @@ function toRepoPath(filePath: string): string {
return path.relative(ROOT, filePath).split(path.sep).join("/");
}
export function formatControlUiCatalogFallbackDriftError(): string {
return [
"control-ui catalog fallback baseline drift detected.",
"Run `pnpm ui:i18n:sync` (included in `pnpm release:prep`) and commit the generated locale artifacts.",
].join("\n");
}
async function importLocaleModule<T>(filePath: string): Promise<T> {
const stats = await stat(filePath);
return (await import(`${pathToFileURL(filePath).href}?ts=${stats.mtimeMs}`)) as T;
@@ -206,12 +213,7 @@ export async function syncControlUiCatalogFallbackBaseline(options: {
await writeFile(FALLBACK_BASELINE_PATH, expected, "utf8");
}
if (options.checkOnly && current !== expected) {
throw new Error(
[
"control-ui catalog fallback baseline drift detected.",
`Run \`pnpm ui:i18n:baseline\` and commit ${toRepoPath(FALLBACK_BASELINE_PATH)}.`,
].join("\n"),
);
throw new Error(formatControlUiCatalogFallbackDriftError());
}
printCatalogFallbackSummary(baseline);
}
+9
View File
@@ -14,6 +14,7 @@ import {
import {
analyzeControlUiCatalogs,
flattenControlUiCatalog,
formatControlUiCatalogFallbackDriftError,
} from "../../scripts/control-ui-i18n-verify.ts";
import {
appendBoundedProcessOutput,
@@ -158,6 +159,14 @@ async function waitForChildClose(
}
describe("control-ui-i18n process runner", () => {
it("points strict catalog drift at the generated release repair", () => {
const message = formatControlUiCatalogFallbackDriftError();
expect(message).toContain("pnpm ui:i18n:sync");
expect(message).toContain("pnpm release:prep");
expect(message).not.toContain("pnpm ui:i18n:baseline");
});
it("builds a deterministic fallback list without accepting catalog drift", () => {
const source = flattenControlUiCatalog(
{ group: { first: "First {count}", second: "Second" } },