(starterUrl: string)
| 71 | } |
| 72 | |
| 73 | function getStarterIdsFromUrl(starterUrl: string) { |
| 74 | const ids = new Set<string>() |
| 75 | |
| 76 | try { |
| 77 | const pathname = new URL(starterUrl).pathname |
| 78 | const parts = pathname.split('/').filter(Boolean) |
| 79 | const lastPart = parts.at(-1)?.toLowerCase() |
| 80 | |
| 81 | if (lastPart) { |
| 82 | ids.add(lastPart.replace(/\.json$/i, '')) |
| 83 | } |
| 84 | |
| 85 | if ( |
| 86 | (lastPart === 'starter.json' || lastPart === 'template.json') && |
| 87 | parts.length >= 2 |
| 88 | ) { |
| 89 | ids.add(parts.at(-2)!.toLowerCase()) |
| 90 | } |
| 91 | } catch { |
| 92 | // Ignore URL parse errors and rely on other id heuristics. |
| 93 | } |
| 94 | |
| 95 | return ids |
| 96 | } |
| 97 | |
| 98 | function resolveMonorepoStarterById( |
| 99 | starterId: string, |
no test coverage detected