* Determine the language the user wants to export. * @param lang - The language to export the input to. * @returns
(lang?: string)
| 144 | * @returns |
| 145 | */ |
| 146 | async function requireLang(lang?: string): Promise<string> { |
| 147 | if (!lang) { |
| 148 | const guessedLang = guessLang() |
| 149 | lang = await prompts({ |
| 150 | type: 'select', |
| 151 | name: 'lang', |
| 152 | message: 'What language should be used?', |
| 153 | choices: [ |
| 154 | guessedLang === 'ts' |
| 155 | ? { title: 'TypeScript', value: 'ts' } |
| 156 | : { title: 'JavaScript', value: 'js' }, |
| 157 | guessedLang === 'ts' |
| 158 | ? { title: 'JavaScript', value: 'js' } |
| 159 | : { title: 'TypeScript', value: 'ts' }, |
| 160 | ], |
| 161 | }).then((val) => val.lang) |
| 162 | if (!lang) { |
| 163 | error('No language selected, exiting.') |
| 164 | } |
| 165 | } |
| 166 | return lang |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Fetch the input name that the user wants to export. |
no test coverage detected