mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
fix(ci): repair TypeScript LOC ratchet baseline (#105991)
This commit is contained in:
committed by
GitHub
parent
d9623bd46f
commit
415bd25313
@@ -6,6 +6,7 @@ import { resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
const DEFAULT_BASELINE_PATH = "scripts/ts-max-loc-baseline-v2.json";
|
||||
const CONTROL_UI_LOCALE_BUNDLE_PATTERN = /^ui\/src\/i18n\/locales\/[^/]+\.ts$/u;
|
||||
|
||||
function writeStdoutLine(message: string): void {
|
||||
process.stdout.write(`${message}\n`);
|
||||
@@ -80,6 +81,8 @@ function gitLsFilesAll(): string[] {
|
||||
export function isProductionTypeScriptFile(filePath: string): boolean {
|
||||
return (
|
||||
/\.(?:ts|tsx|mts|cts)$/u.test(filePath) &&
|
||||
// Locale bundles grow with every translation key and are governed by the i18n generator.
|
||||
!CONTROL_UI_LOCALE_BUNDLE_PATTERN.test(filePath) &&
|
||||
!/(^|\/)(test|tests|__tests__|test-helpers?|test-support)(\/|$)|\.(test|spec|suite)\.[cm]?tsx?$|(?:^|[/.-])test-(?:helpers?|support|harness)(?:[/.-]|$)/u.test(
|
||||
filePath,
|
||||
)
|
||||
|
||||
@@ -1186,27 +1186,6 @@
|
||||
"ui/src/components/markdown.ts": 1493,
|
||||
"ui/src/components/terminal/terminal-panel.ts": 1182,
|
||||
"ui/src/components/tooltip.ts": 502,
|
||||
"ui/src/i18n/locales/ar.ts": 3758,
|
||||
"ui/src/i18n/locales/de.ts": 3830,
|
||||
"ui/src/i18n/locales/en.ts": 3763,
|
||||
"ui/src/i18n/locales/es.ts": 3827,
|
||||
"ui/src/i18n/locales/fa.ts": 3783,
|
||||
"ui/src/i18n/locales/fr.ts": 3850,
|
||||
"ui/src/i18n/locales/hi.ts": 3753,
|
||||
"ui/src/i18n/locales/id.ts": 3791,
|
||||
"ui/src/i18n/locales/it.ts": 3830,
|
||||
"ui/src/i18n/locales/ja-JP.ts": 3800,
|
||||
"ui/src/i18n/locales/ko.ts": 3771,
|
||||
"ui/src/i18n/locales/nl.ts": 3805,
|
||||
"ui/src/i18n/locales/pl.ts": 3817,
|
||||
"ui/src/i18n/locales/pt-BR.ts": 3800,
|
||||
"ui/src/i18n/locales/ru.ts": 3819,
|
||||
"ui/src/i18n/locales/th.ts": 3728,
|
||||
"ui/src/i18n/locales/tr.ts": 3814,
|
||||
"ui/src/i18n/locales/uk.ts": 3802,
|
||||
"ui/src/i18n/locales/vi.ts": 3777,
|
||||
"ui/src/i18n/locales/zh-CN.ts": 3714,
|
||||
"ui/src/i18n/locales/zh-TW.ts": 3720,
|
||||
"ui/src/lib/agents/display.ts": 661,
|
||||
"ui/src/lib/chat/commands.ts": 537,
|
||||
"ui/src/lib/chat/message-normalizer.ts": 530,
|
||||
|
||||
@@ -111,6 +111,12 @@ describe("scripts/check-ts-max-loc", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("excludes Control UI locale bundles", () => {
|
||||
expect(isProductionTypeScriptFile("ui/src/i18n/locales/en.ts")).toBe(false);
|
||||
expect(isProductionTypeScriptFile("ui/src/i18n/locales/fr.ts")).toBe(false);
|
||||
expect(isProductionTypeScriptFile("ui/src/i18n/lib/translate.ts")).toBe(true);
|
||||
});
|
||||
|
||||
it("allows baseline updates only for decreases and removals", () => {
|
||||
const violations = findLocBaselineUpdateViolations({
|
||||
maxLines: 500,
|
||||
|
||||
Reference in New Issue
Block a user