ci(frontend): remove docs terminology coupling

main
wizardchen 2026-07-30 17:29:42 +08:00 committed by lyingbug
parent 0bf9286a2e
commit 2611babfef
2 changed files with 0 additions and 54 deletions

View File

@ -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:

View File

@ -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')
})