diff --git a/apps/mobile-shell/scripts/check-config.mjs b/apps/mobile-shell/scripts/check-config.mjs index f3fb7368d..5da77bed6 100644 --- a/apps/mobile-shell/scripts/check-config.mjs +++ b/apps/mobile-shell/scripts/check-config.mjs @@ -332,6 +332,10 @@ const requiredMobileShellScriptModules = [ 'check-expo-config.mjs', 'check-expo-export.mjs', ]; +const productionSourceExcludedDirectories = new Set([ + 'node_modules', + 'test-utils', +]); const devScaffoldTerms = [ 'mo' + 'ck', 'fa' + 'ke', @@ -649,6 +653,11 @@ 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), @@ -806,6 +815,14 @@ for (const snippet of [ } } +for (const excludedDirectory of productionSourceExcludedDirectories) { + if (!nativeShellCheckSource.includes(`'${excludedDirectory}'`)) { + throw new Error( + `root native shell check is missing mobile source exclusion: ${excludedDirectory}`, + ); + } +} + assertNoDevScaffoldTerms( productionSourceRoots.flatMap((root) => collectProductionSourceFiles(root)), );