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

Function selectTemplate

packages/cli/src/ui-prompts.ts:110–140  ·  view source on GitHub ↗
(
  templates: Array<{ id: string; name: string; description?: string }>,
)

Source from the content-addressed store, hash-verified

108}
109
110export async function selectTemplate(
111 templates: Array<{ id: string; name: string; description?: string }>,
112): Promise<string | undefined> {
113 if (templates.length === 0) {
114 return undefined
115 }
116
117 const selected = await select({
118 message: 'Would you like to start from a template?',
119 options: [
120 {
121 value: undefined,
122 label: 'None (base starter)',
123 hint: 'Two-page baseline (Home + About)',
124 },
125 ...templates.map((template) => ({
126 value: template.id,
127 label: template.name,
128 hint: template.description,
129 })),
130 ],
131 initialValue: undefined,
132 })
133
134 if (isCancel(selected)) {
135 cancel('Operation cancelled.')
136 process.exit(0)
137 }
138
139 return selected
140}
141
142export async function selectAddOns(
143 framework: Framework,

Callers 2

ui-prompts.test.tsFile · 0.90
promptForCreateOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected