| 91 | } |
| 92 | |
| 93 | async function selectPlatforms( |
| 94 | detected: Set<string>, |
| 95 | options: InitOptions, |
| 96 | lang: string, |
| 97 | ): Promise<string[]> { |
| 98 | const choices = PLATFORMS.map((p) => ({ |
| 99 | name: `${p.name}${detected.has(p.id) ? ` (${t(lang, 'detected')})` : ''}`, |
| 100 | value: p.id, |
| 101 | checked: detected.has(p.id), |
| 102 | })); |
| 103 | |
| 104 | if (options.yes) { |
| 105 | const selected = [...detected]; |
| 106 | return selected.length > 0 ? selected : PLATFORMS.map((p) => p.id); |
| 107 | } |
| 108 | |
| 109 | return checkbox({ message: t(lang, 'selectPlatforms'), choices, required: true }); |
| 110 | } |
| 111 | |
| 112 | async function promptOverwriteChoice( |
| 113 | componentName: string, |