(dir: string)
| 1367 | * file serve as the structural signal instead. |
| 1368 | */ |
| 1369 | export async function detectBrighterScriptTemplateRoot(dir: string): Promise<boolean> { |
| 1370 | if (await hasRokuManifest(dir)) return false; |
| 1371 | const bsConfigPath = join(dir, "bsconfig.json"); |
| 1372 | try { |
| 1373 | await stat(bsConfigPath); |
| 1374 | } catch { |
| 1375 | return false; |
| 1376 | } |
| 1377 | // Layout 1: rokucommunity template — manifest lives under src/ |
| 1378 | if (await hasRokuManifest(join(dir, "src"))) return true; |
| 1379 | // Layout 2: channel-at-root without manifest — source/ or components/ with .brs |
| 1380 | const hasBrsIn = async (subdir: string): Promise<boolean> => { |
| 1381 | try { |
| 1382 | const entries = await readdir(join(dir, subdir), { withFileTypes: true }); |
| 1383 | return entries.some((e) => e.isFile() && (e.name.endsWith(".brs") || e.name.endsWith(".bs"))); |
| 1384 | } catch { |
| 1385 | return false; |
| 1386 | } |
| 1387 | }; |
| 1388 | if (await hasBrsIn("source")) return true; |
| 1389 | if (await hasBrsIn("components")) return true; |
| 1390 | return false; |
| 1391 | } |
| 1392 | |
| 1393 | /** |
| 1394 | * Detect a Roku multi-channel monorepo layout. 90% of Roku repos are |
no test coverage detected