(dirPath: string)
| 59 | * @return A list of apps detected. |
| 60 | */ |
| 61 | export 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 | |
| 89 | async function processIosDir(dirPath: string, filePath: string): Promise<App[]> { |
| 90 | // Search for apps in the parent directory |
no test coverage detected
searching dependent graphs…