(defaultProject: string|undefined, options: unknown)
| 125 | }; |
| 126 | |
| 127 | export const projectPrompt = async (defaultProject: string|undefined, options: unknown) => { |
| 128 | const firebaseTools = await getFirebaseTools(); |
| 129 | const projects = await firebaseTools.projects.list(options); |
| 130 | const { projectId } = await autocomplete({ |
| 131 | type: 'autocomplete', |
| 132 | name: 'projectId', |
| 133 | source: searchProjects(projects), |
| 134 | message: 'Please select a project:', |
| 135 | default: defaultProject, |
| 136 | }); |
| 137 | if (projectId === NEW_OPTION) { |
| 138 | const { projectId } = await inquirer.prompt({ |
| 139 | type: 'input', |
| 140 | name: 'projectId', |
| 141 | message: `Please specify a unique project id (cannot be modified afterward) [6-30 characters]:`, |
| 142 | }) as { projectId: string }; |
| 143 | const { displayName } = await inquirer.prompt({ |
| 144 | type: 'input', |
| 145 | name: 'displayName', |
| 146 | message: 'What would you like to call your project?', |
| 147 | default: projectId, |
| 148 | }) as { displayName: string }; |
| 149 | return await firebaseTools.projects.create(projectId, { account: (options as any).account, displayName, nonInteractive: true }); |
| 150 | } |
| 151 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 152 | return (projects).find(it => it.projectId === projectId)!; |
| 153 | }; |
| 154 | |
| 155 | export const appPrompt = async ({ projectId: project }: FirebaseProject, defaultAppId: string|undefined, options: any) => { |
| 156 | const firebaseTools = await getFirebaseTools(); |
no test coverage detected