diff --git a/scripts/check-native-shells.mjs b/scripts/check-native-shells.mjs index 7c61b101c..c11327b07 100644 --- a/scripts/check-native-shells.mjs +++ b/scripts/check-native-shells.mjs @@ -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();