From 2611babfef14b2ea6f59fc39538fbd978af78cf6 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Thu, 30 Jul 2026 17:29:42 +0800 Subject: [PATCH] ci(frontend): remove docs terminology coupling --- .github/workflows/frontend.yml | 13 ------ .../i18n/locales/workspaceTerminology.test.ts | 41 ------------------- 2 files changed, 54 deletions(-) diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index 0b04ec96..14df10f2 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -6,24 +6,11 @@ on: paths: - "frontend/**" - "scripts/build_frontend_dist.sh" - # The frontend terminology regression test also scans these public docs. - - ".env.example" - - "README_CN.md" - - "client/**" - - "docker-compose.yml" - - "docs/**" - - "mcp-server/**" - ".github/workflows/frontend.yml" pull_request: paths: - "frontend/**" - "scripts/build_frontend_dist.sh" - - ".env.example" - - "README_CN.md" - - "client/**" - - "docker-compose.yml" - - "docs/**" - - "mcp-server/**" - ".github/workflows/frontend.yml" workflow_dispatch: diff --git a/frontend/src/i18n/locales/workspaceTerminology.test.ts b/frontend/src/i18n/locales/workspaceTerminology.test.ts index 492930f7..ecc7ddf4 100644 --- a/frontend/src/i18n/locales/workspaceTerminology.test.ts +++ b/frontend/src/i18n/locales/workspaceTerminology.test.ts @@ -1,8 +1,5 @@ import assert from 'node:assert/strict' -import { readdirSync, readFileSync } from 'node:fs' -import { dirname, extname, resolve } from 'node:path' import test from 'node:test' -import { fileURLToPath } from 'node:url' import enUS from './en-US.ts' import koKR from './ko-KR.ts' @@ -41,26 +38,6 @@ const localeChecks = [ { name: 'ru-RU', locale: ruRU, forbidden: /(?:тенант|арендатор)/i }, ] -const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), '../../../..') -const publicDocumentationRoots = [ - '.env.example', - 'README_CN.md', - 'client', - 'docker-compose.yml', - 'docs', - 'mcp-server', -] -const documentationExtensions = new Set(['.go', '.json', '.md', '.yaml', '.yml']) - -function collectDocumentationFiles(path: string): string[] { - const entries = readdirSync(path, { withFileTypes: true }) - return entries.flatMap((entry) => { - const child = resolve(path, entry.name) - if (entry.isDirectory()) return collectDocumentationFiles(child) - return documentationExtensions.has(extname(entry.name)) ? [child] : [] - }) -} - test('user-facing locale values use workspace terminology', () => { for (const check of localeChecks) { const legacyValues = collectStrings(check.locale) @@ -74,21 +51,3 @@ test('user-facing locale values use workspace terminology', () => { ) } }) - -test('public documentation uses workspace terminology', () => { - const legacyLines = publicDocumentationRoots.flatMap((relativePath) => { - const absolutePath = resolve(repositoryRoot, relativePath) - const files = extname(absolutePath) ? [absolutePath] : collectDocumentationFiles(absolutePath) - return files.flatMap((file) => - readFileSync(file, 'utf8') - .split('\n') - .flatMap((line, index) => - line.includes('租户') - ? [`${file.slice(repositoryRoot.length + 1)}:${index + 1}=${line.trim()}`] - : [], - ), - ) - }) - - assert.deepEqual(legacyLines, [], 'public documentation still contains legacy tenant terminology') -})