MCPcopy Create free account
hub / github.com/TanStack/cli / getStarterIdsFromUrl

Function getStarterIdsFromUrl

packages/cli/src/command-line.ts:73–96  ·  view source on GitHub ↗
(starterUrl: string)

Source from the content-addressed store, hash-verified

71}
72
73function 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
98function resolveMonorepoStarterById(
99 starterId: string,

Callers 2

resolveStarterSpecifierFunction · 0.85
listTemplateChoicesFunction · 0.85

Calls 2

addMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected