@@ -40,14 +40,13 @@ const sourceExtensions = new Set([".swift", ".kt", ".kts"]);
4040const excludedDirectories = new Set ( [
4141 ".expo" ,
4242 ".git" ,
43- "android" ,
4443 "build" ,
4544 "DerivedData" ,
46- "ios" ,
4745 "node_modules" ,
4846 "Pods" ,
4947 "Vendor" ,
5048] ) ;
49+ const generatedNativeProjectDirectories = new Set ( [ "android" , "ios" ] ) ;
5150
5251const appRoot = Effect . service ( Path . Path ) . pipe (
5352 Effect . flatMap ( ( path ) => path . fromFileUrl ( new URL ( "../apps/mobile" , import . meta. url ) ) ) ,
@@ -108,6 +107,7 @@ const runCommand = Effect.fn("runCommand")(function* (
108107
109108function collectSources (
110109 directory : string ,
110+ root : string ,
111111) : Effect . Effect <
112112 ReadonlyArray < string > ,
113113 PlatformError . PlatformError ,
@@ -120,15 +120,18 @@ function collectSources(
120120 const sources : Array < string > = [ ] ;
121121
122122 for ( const entry of entries ) {
123- if ( excludedDirectories . has ( entry ) ) {
124- continue ;
125- }
126-
127123 const entryPath = path . join ( directory , entry ) ;
128124 const stat = yield * fs . stat ( entryPath ) ;
129125
130126 if ( stat . type === "Directory" ) {
131- sources . push ( ...( yield * collectSources ( entryPath ) ) ) ;
127+ const isGeneratedNativeProjectDirectory =
128+ directory === root && generatedNativeProjectDirectories . has ( entry ) ;
129+
130+ if ( excludedDirectories . has ( entry ) || isGeneratedNativeProjectDirectory ) {
131+ continue ;
132+ }
133+
134+ sources . push ( ...( yield * collectSources ( entryPath , root ) ) ) ;
132135 continue ;
133136 }
134137
@@ -144,7 +147,7 @@ function collectSources(
144147const runNativeStaticChecks = Effect . fn ( "runNativeStaticChecks" ) ( function * ( ) {
145148 const path = yield * Path . Path ;
146149 const root = yield * appRoot ;
147- const sources = yield * collectSources ( root ) ;
150+ const sources = yield * collectSources ( root , root ) ;
148151 const swiftSources = sources . filter ( ( source ) => path . extname ( source ) === ".swift" ) ;
149152 const kotlinSources = sources . filter ( ( source ) => {
150153 const extension = path . extname ( source ) ;
@@ -156,6 +159,10 @@ const runNativeStaticChecks = Effect.fn("runNativeStaticChecks")(function* () {
156159 availableTools . set ( tool . command , yield * commandExists ( tool . command ) ) ;
157160 }
158161
162+ yield * Console . log (
163+ `Found ${ swiftSources . length } Swift and ${ kotlinSources . length } Kotlin native source files.` ,
164+ ) ;
165+
159166 if ( swiftSources . length > 0 ) {
160167 if ( availableTools . get ( "swiftlint" ) ) {
161168 yield * runCommand ( "swiftlint" , [ "lint" , "--config" , ".swiftlint.yml" , "--strict" ] , root ) ;
0 commit comments