@@ -9,10 +9,6 @@ import * as spawnAsyncModule from "@expo/spawn-async";
99
1010const spawnAsync = spawnAsyncModule . default || spawnAsyncModule ;
1111
12- import * as globModule from "fast-glob" ;
13-
14- const glob = globModule . default || globModule ;
15-
1612import * as path from "node:path" ;
1713import { pipeline } from "node:stream/promises" ;
1814import * as fs from "fs-extra" ;
@@ -174,15 +170,50 @@ export async function extractAppFromLocalArchiveAsync(
174170 ) ;
175171}
176172
173+ /**
174+ * Recursively finds files with a specific extension
175+ *
176+ * @param {string } dir - Directory to search in
177+ * @param {string } extension - File extension to search for
178+ * @returns {Promise<string[]> } - Array of relative file paths
179+ */
180+ async function findFilesByExtension (
181+ dir : string ,
182+ extension : string ,
183+ ) : Promise < string [ ] > {
184+ const results : string [ ] = [ ] ;
185+
186+ async function searchRecursively (
187+ currentDir : string ,
188+ relativePath = "" ,
189+ ) : Promise < void > {
190+ const entries = await fs . readdir ( currentDir , { withFileTypes : true } ) ;
191+
192+ for ( const entry of entries ) {
193+ const fullPath = path . join ( currentDir , entry . name ) ;
194+ const relPath = path . join ( relativePath , entry . name ) ;
195+
196+ if ( entry . isDirectory ( ) ) {
197+ await searchRecursively ( fullPath , relPath ) ;
198+ } else if ( entry . isFile ( ) && fullPath . endsWith ( `.${ extension } ` ) ) {
199+ results . push ( relPath ) ;
200+ }
201+ }
202+ }
203+
204+ await searchRecursively ( dir ) ;
205+ return results ;
206+ }
207+
177208async function getAppPathAsync (
178209 outputDir : string ,
179210 applicationExtension : string ,
180211) : Promise < string > {
181212 logger . startSpinner ( `Locating ${ applicationExtension } file` ) ;
182- const appFilePaths = await glob ( `./**/*. ${ applicationExtension } ` , {
183- cwd : outputDir ,
184- onlyFiles : false ,
185- } ) ;
213+ const appFilePaths = await findFilesByExtension (
214+ outputDir ,
215+ applicationExtension ,
216+ ) ;
186217 if ( appFilePaths . length === 0 ) {
187218 logger . failSpinner ( "Search failed" ) ;
188219 throw Error ( "Did not find any installable apps inside tarball." ) ;
0 commit comments