(
templates: Array<{ id: string; name: string; description?: string }>,
)
| 108 | } |
| 109 | |
| 110 | export 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 | |
| 142 | export async function selectAddOns( |
| 143 | framework: Framework, |
no outgoing calls
no test coverage detected