({ projectId: project }: FirebaseProject, defaultAppId: string|undefined, options: any)
| 153 | }; |
| 154 | |
| 155 | export const appPrompt = async ({ projectId: project }: FirebaseProject, defaultAppId: string|undefined, options: any) => { |
| 156 | const firebaseTools = await getFirebaseTools(); |
| 157 | const apps = await firebaseTools.apps.list('web', { ...options, project }); |
| 158 | const { appId } = await autocomplete({ |
| 159 | type: 'autocomplete', |
| 160 | name: 'appId', |
| 161 | source: searchApps(apps), |
| 162 | message: 'Please select an app:', |
| 163 | default: defaultAppId, |
| 164 | }); |
| 165 | if (appId === NEW_OPTION) { |
| 166 | const { displayName } = await inquirer.prompt({ |
| 167 | type: 'input', |
| 168 | name: 'displayName', |
| 169 | message: 'What would you like to call your app?', |
| 170 | }) as { displayName: string }; |
| 171 | return await firebaseTools.apps.create('web', displayName, { ...options, nonInteractive: true, project }); |
| 172 | } |
| 173 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 174 | return (apps).find(it => shortAppId(it) === appId)!; |
| 175 | }; |
no test coverage detected