mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(release): point locale drift at generated sync
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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" } },
|
||||
|
||||
Reference in New Issue
Block a user