收口原生壳替身词扫描范围
桌面壳配置检查跳过 Tauri target 构建产物 原生壳文档说明替身词扫描只覆盖源码和配置 共享项目记忆记录构建产物不进入生产扫描
This commit is contained in:
@@ -173,6 +173,9 @@ const productionSourceRoots = [
|
||||
new URL('../src-tauri/tauri.conf.json', import.meta.url),
|
||||
];
|
||||
const productionFileExtensions = new Set(['.json', '.mjs', '.plist', '.rs', '.toml']);
|
||||
const productionSourceExcludedDirectories = new Set([
|
||||
'target',
|
||||
]);
|
||||
const devScaffoldTerms = [
|
||||
'mo' + 'ck',
|
||||
'fa' + 'ke',
|
||||
@@ -540,6 +543,10 @@ function collectProductionSourceFiles(entry) {
|
||||
const directory = entry.href.endsWith('/') ? entry : new URL(`${entry.href}/`);
|
||||
return fs
|
||||
.readdirSync(entry, { withFileTypes: true })
|
||||
.filter(
|
||||
(child) =>
|
||||
!child.isDirectory() || !productionSourceExcludedDirectories.has(child.name),
|
||||
)
|
||||
.flatMap((child) =>
|
||||
collectProductionSourceFiles(
|
||||
new URL(`${child.name}${child.isDirectory() ? '/' : ''}`, directory),
|
||||
@@ -584,7 +591,7 @@ function assertNoDevScaffoldTerms(files) {
|
||||
}
|
||||
const line = lineStarts.filter((start) => start <= matchIndex).length;
|
||||
throw new Error(
|
||||
`desktop shell production source must not include ${term}: ${file.pathname}:${line}`,
|
||||
`desktop shell production source/config must not include ${term}: ${file.pathname}:${line}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user