in src/schematics/setup/prompts.ts [97:132]
value: shortSiteName(original),
};
});
});
type Prompt = <K extends string, U= unknown>(questions: { name: K, source: (...args) =>
Promise<{ value: U }[]>, default?: U | ((o: U[]) => U | Promise<U>), [key: string]: any }) =>
Promise<{[T in K]: U }>;
const autocomplete: Prompt = (questions) => inquirer.prompt(questions);
export const featuresPrompt = async (): Promise<FEATURES[]> => {
const { features } = await inquirer.prompt({
type: 'checkbox',
name: 'features',
choices: featureOptions,
message: 'What features would you like to setup?',
default: [FEATURES.Hosting],
});
return features;
};
export const userPrompt = async (options: {}): Promise<Record<string, any>> => {
const firebaseTools = await getFirebaseTools();
const users = await firebaseTools.login.list();
if (!users || users.length === 0) {
await firebaseTools.login(); // first login isn't returning anything of value
const user = await firebaseTools.login(options);
return user;
} else {
const defaultUser = await firebaseTools.login(options);
const choices = users.map(({user}) => ({ name: user.email, value: user }));
const newChoice = { name: '[Login in with another account]', value: NEW_OPTION };
const { user } = await inquirer.prompt({