补齐原生壳生成产物追踪门禁

统一反查 dist 与 build/native 不入库

统一反查 Expo 和 Tauri 生成目录不入库

在原生壳验收中增加生成产物边界节点
This commit is contained in:
2026-06-21 20:51:20 +08:00
parent 75abcf6fd4
commit 1f4afcdc19
+37
View File
@@ -1624,6 +1624,15 @@ const productionShellExcludedPaths = new Set([
'apps/desktop-shell/src-tauri/gen',
'apps/desktop-shell/src-tauri/permissions/autogenerated',
]);
const generatedNativeShellArtifactPaths = [
'build/native',
'dist',
'apps/mobile-shell/.expo',
'apps/mobile-shell/.expo-export-smoke',
'apps/desktop-shell/src-tauri/target',
'apps/desktop-shell/src-tauri/gen',
'apps/desktop-shell/src-tauri/permissions/autogenerated',
];
const productionShellDevScaffoldTerms = [
'mo' + 'ck',
'fa' + 'ke',
@@ -1791,6 +1800,31 @@ function shouldScanH5ProductionSourceFile(filePath) {
return h5ProductionSourceExtensions.has(path.extname(filePath));
}
function assertNoTrackedGeneratedNativeShellArtifacts() {
const result = spawnSync('git', ['ls-files', ...generatedNativeShellArtifactPaths], {
cwd: process.cwd(),
encoding: 'utf8',
});
if (result.error) {
throw new Error(`unable to check generated native shell artifacts: ${result.error.message}`);
}
if (result.status !== 0) {
throw new Error(
`unable to check generated native shell artifacts: ${result.stderr.trim()}`,
);
}
const trackedArtifacts = result.stdout
.split('\n')
.map((entry) => entry.trim())
.filter(Boolean);
if (trackedArtifacts.length > 0) {
throw new Error(
`generated native shell artifacts must stay untracked: ${trackedArtifacts.join(', ')}`,
);
}
}
function collectProductionShellFiles(entryPath) {
const normalizedPath = entryPath.split(path.sep).join('/');
if (productionShellExcludedPaths.has(normalizedPath)) {
@@ -4217,6 +4251,9 @@ assertH5NativeAppMessageSourceBoundaries();
console.log('[check:native-shells] h5-native-app-transport-facade-boundary');
assertH5NativeAppTransportFacadeBoundary();
console.log('[check:native-shells] generated-native-shell-artifact-boundary');
assertNoTrackedGeneratedNativeShellArtifacts();
console.log('[check:native-shells] production-shell-dev-scaffold-scan');
assertNoProductionShellDevScaffoldTerms();