锁定原生壳生成物忽略规则

总验收校验原生壳生成物未被追踪

总验收校验原生壳生成物仍被 gitignore 覆盖

同步宿主壳方案文档和项目决策记录
This commit is contained in:
2026-06-21 21:05:29 +08:00
parent 3dfd61f0a0
commit facbd29f06
3 changed files with 55 additions and 1 deletions
+46
View File
@@ -1679,6 +1679,15 @@ const generatedNativeShellArtifactPaths = [
'apps/desktop-shell/src-tauri/gen',
'apps/desktop-shell/src-tauri/permissions/autogenerated',
];
const generatedNativeShellArtifactIgnoreProbePaths = [
'build/native/probe',
'dist/probe',
'apps/mobile-shell/.expo/probe',
'apps/mobile-shell/.expo-export-smoke/probe',
'apps/desktop-shell/src-tauri/target/probe',
'apps/desktop-shell/src-tauri/gen/probe',
'apps/desktop-shell/src-tauri/permissions/autogenerated/probe',
];
const productionShellDevScaffoldTerms = [
'mo' + 'ck',
'fa' + 'ke',
@@ -1871,6 +1880,42 @@ function assertNoTrackedGeneratedNativeShellArtifacts() {
}
}
function assertGeneratedNativeShellArtifactsAreIgnored() {
const result = spawnSync(
'git',
['check-ignore', '-v', ...generatedNativeShellArtifactIgnoreProbePaths],
{
cwd: process.cwd(),
encoding: 'utf8',
},
);
if (result.error) {
throw new Error(
`unable to check generated native shell artifact gitignore rules: ${result.error.message}`,
);
}
if (result.status !== 0) {
throw new Error(
`generated native shell artifacts must be gitignored: ${result.stderr.trim() || result.stdout.trim()}`,
);
}
const ignoredArtifacts = new Set(
result.stdout
.split('\n')
.map((entry) => entry.trim().split(/\t/).pop())
.filter(Boolean),
);
const missingArtifacts = generatedNativeShellArtifactIgnoreProbePaths.filter(
(artifactPath) => !ignoredArtifacts.has(artifactPath),
);
if (missingArtifacts.length > 0) {
throw new Error(
`generated native shell artifacts missing gitignore coverage: ${missingArtifacts.join(', ')}`,
);
}
}
function collectProductionShellFiles(entryPath) {
const normalizedPath = entryPath.split(path.sep).join('/');
if (productionShellExcludedPaths.has(normalizedPath)) {
@@ -4299,6 +4344,7 @@ assertH5NativeAppTransportFacadeBoundary();
console.log('[check:native-shells] generated-native-shell-artifact-boundary');
assertNoTrackedGeneratedNativeShellArtifacts();
assertGeneratedNativeShellArtifactsAreIgnored();
console.log('[check:native-shells] production-shell-dev-scaffold-scan');
assertNoProductionShellDevScaffoldTerms();