@@ -7,6 +7,10 @@ const defaultRepoRoot = process.cwd();
77const defaultMaxLines = 900 ;
88const scanRoots = [ "apps" , "examples" , "packages" , "scripts" ] ;
99const sourceExtensions = new Set ( [ ".js" , ".jsx" , ".mjs" , ".ts" , ".tsx" ] ) ;
10+ const ignoredFiles = new Set ( [
11+ "apps/site/src/previews/proStub.tsx" ,
12+ "apps/site/src/previews/reactNativeWebStub.tsx"
13+ ] ) ;
1014const ignoredDirectories = new Set ( [
1115 ".expo" ,
1216 ".next" ,
@@ -56,6 +60,9 @@ const countLines = async (filePath) => {
5660 return normalizedSource === "" ? 0 : normalizedSource . split ( "\n" ) . length ;
5761} ;
5862
63+ const toRepoPath = ( repoRoot , filePath ) =>
64+ path . relative ( repoRoot , filePath ) . split ( path . sep ) . join ( "/" ) ;
65+
5966export const checkFileSizes = async ( {
6067 maxLines = defaultMaxLines ,
6168 repoRoot = defaultRepoRoot
@@ -76,11 +83,12 @@ export const checkFileSizes = async ({
7683
7784 const files = ( await Promise . all ( existingRoots . map ( collectSourceFiles ) ) )
7885 . flat ( )
86+ . filter ( ( filePath ) => ! ignoredFiles . has ( toRepoPath ( repoRoot , filePath ) ) )
7987 . sort ( ) ;
8088 const results = await Promise . all (
8189 files . map ( async ( filePath ) => ( {
8290 lines : await countLines ( filePath ) ,
83- path : path . relative ( repoRoot , filePath )
91+ path : toRepoPath ( repoRoot , filePath )
8492 } ) )
8593 ) ;
8694 const oversized = results
0 commit comments