MCPcopy Create free account
hub / github.com/firebase/firebase-tools / detectApps

Function detectApps

src/appUtils.ts:61–87  ·  view source on GitHub ↗
(dirPath: string)

Source from the content-addressed store, hash-verified

59 * @return A list of apps detected.
60 */
61export async function detectApps(dirPath: string): Promise<App[]> {
62 const [packageJsonFiles, pubSpecYamlFiles, srcMainFolders, xCodeProjects] = await Promise.all([
63 detectFiles(dirPath, "package.json"),
64 detectFiles(dirPath, "pubspec.yaml"),
65 detectFiles(dirPath, "src/main/"),
66 detectFiles(dirPath, "*.xcodeproj/"),
67 ]);
68
69 const [adminAndWebApps, flutterApps, androidAppsRaw, iosAppsRaw] = await Promise.all([
70 Promise.all(packageJsonFiles.map((p) => packageJsonToAdminOrWebApp(dirPath, p))).then((r) =>
71 r.flat(),
72 ),
73 Promise.all(pubSpecYamlFiles.map((f) => processFlutterDir(dirPath, f))).then((r) => r.flat()),
74 Promise.all(srcMainFolders.map((f) => processAndroidDir(dirPath, f))).then((r) => r.flat()),
75 Promise.all(xCodeProjects.map((f) => processIosDir(dirPath, f))).then((r) => r.flat()),
76 ]);
77
78 const androidApps = androidAppsRaw.filter(
79 (a) => !flutterApps.some((f) => isPathInside(f.directory, a.directory)),
80 );
81
82 const iosApps = iosAppsRaw.filter(
83 (a) => !flutterApps.some((f) => isPathInside(f.directory, a.directory)),
84 );
85
86 return [...flutterApps, ...androidApps, ...iosApps, ...adminAndWebApps];
87}
88
89async function processIosDir(dirPath: string, filePath: string): Promise<App[]> {
90 // Search for apps in the parent directory

Callers 5

appUtils.spec.tsFile · 0.90
chooseAppFunction · 0.90
actuateWithInfoFunction · 0.90
get_environment.tsFile · 0.90
getPlatformsFromFolderFunction · 0.85

Calls 7

detectFilesFunction · 0.85
processFlutterDirFunction · 0.85
processAndroidDirFunction · 0.85
processIosDirFunction · 0.85
allMethod · 0.80
isPathInsideFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…