(targetPath: string)
| 226 | * For React Native CLI, it could be 'src' or the root |
| 227 | */ |
| 228 | export async function detectRootFolder(targetPath: string): Promise<string> { |
| 229 | // Check for common folders in order of preference |
| 230 | const possibleRoots = ["app", "src"]; |
| 231 | |
| 232 | for (const root of possibleRoots) { |
| 233 | const rootPath = path.join(targetPath, root); |
| 234 | if (await fs.pathExists(rootPath)) { |
| 235 | const stats = await fs.stat(rootPath); |
| 236 | if (stats.isDirectory()) { |
| 237 | return root; |
| 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | // Default fallback to 'app' for Expo projects or '.' for others |
| 243 | const isExpoProject = await isExpo(targetPath); |
| 244 | return isExpoProject ? "app" : "."; |
| 245 | } |
no test coverage detected