fix(release): normalize i18n audit paths

This commit is contained in:
aliyun1121003339 2026-07-21 23:30:31 +08:00
parent 41efd8a926
commit c43422b014
2 changed files with 14 additions and 2 deletions

View file

@ -42,7 +42,7 @@ const matchers = [
{ kind: 'button-text', regex: /\.setButtonText\((['"`])/ },
{ kind: 'title-text', regex: /titleEl\.setText\((['"`])/ },
{ kind: 'element-text', regex: /createEl\([^)]*\{\s*text:\s*(['"`])/ },
{ kind: 'name-prop', regex: /\bname:\s*(['"`])/ },
{ kind: 'name-prop', regex: /\bname:\s*(['"`])(?!\1)/ },
{ kind: 'placeholder', regex: /\.setPlaceholder\((['"`])/ },
{ kind: 'status-bar', regex: /updateStatusBar\((['"`])/ },
{ kind: 'progress-status', regex: /\.updateStatus\((['"`])/ },
@ -84,7 +84,7 @@ const allFiles = candidateFiles
const absolute = path.join(projectRoot, candidate);
return fs.existsSync(absolute) ? walk(absolute) : [];
})
.map(file => path.relative(projectRoot, file))
.map(file => path.relative(projectRoot, file).split(path.sep).join('/'))
.filter(shouldInspect)
.sort();

View file

@ -11,4 +11,16 @@ describe('hardcoded UI audit script configuration', () => {
expect(source).not.toContain('/definition\\.description/');
expect(source).not.toContain('/definition\\.setupHint/');
});
test('normalizes platform separators before matching candidate directories', () => {
const source = fs.readFileSync(scriptPath, 'utf8');
expect(source).toContain(".split(path.sep).join('/')");
});
test('does not treat an empty name state field as visible UI copy', () => {
const source = fs.readFileSync(scriptPath, 'utf8');
expect(source).toContain("{ kind: 'name-prop', regex: /\\bname:\\s*(['\"`])(?!\\1)/ }");
});
});