(setup: Setup, config: Config, options: Options)
| 121 | // askQuestions prompts the user about the SQL Connect service they want to init. Any prompting |
| 122 | // logic should live here, and _no_ actuation logic should live here. |
| 123 | export async function askQuestions(setup: Setup, config: Config, options: Options): Promise<void> { |
| 124 | const info: RequiredInfo = { |
| 125 | flow: "", |
| 126 | appDescription: "", |
| 127 | serviceId: "", |
| 128 | locationId: "", |
| 129 | cloudSqlInstanceId: "", |
| 130 | cloudSqlDatabase: "", |
| 131 | shouldProvisionCSQL: false, |
| 132 | }; |
| 133 | if (setup.projectId) { |
| 134 | await ensureApis(setup.projectId); |
| 135 | await promptForExistingServices(setup, info, options); |
| 136 | // In an empty project, firebase init dataconnect in non-interactive mode always setup the static movie app template. |
| 137 | if (!info.serviceGql && !options.nonInteractive) { |
| 138 | // TODO: Consider use Gemini to generate schema for Spark project as well. |
| 139 | if (!configstore.get("gemini")) { |
| 140 | logBullet( |
| 141 | "Learn more about Gemini in Firebase and how it uses your data: https://firebase.google.com/docs/gemini-in-firebase#how-gemini-in-firebase-uses-your-data", |
| 142 | ); |
| 143 | } |
| 144 | const wantToGenerate = await confirm({ |
| 145 | message: "Do you want to generate schema and queries with Gemini?", |
| 146 | default: false, |
| 147 | nonInteractive: options.nonInteractive, |
| 148 | }); |
| 149 | if (wantToGenerate) { |
| 150 | configstore.set("gemini", true); |
| 151 | info.appDescription = await input({ |
| 152 | message: `Describe your app idea:`, |
| 153 | validate: async (s: string) => { |
| 154 | if (s.length > 0) { |
| 155 | return true; |
| 156 | } |
| 157 | return "Please enter a description for your app idea."; |
| 158 | }, |
| 159 | nonInteractive: options.nonInteractive, |
| 160 | }); |
| 161 | } |
| 162 | } |
| 163 | await promptForCloudSQL(setup, info, options); |
| 164 | } |
| 165 | setup.featureInfo = setup.featureInfo || {}; |
| 166 | setup.featureInfo.dataconnect = info; |
| 167 | |
| 168 | await sdk.askQuestions(setup, config, options); |
| 169 | } |
| 170 | |
| 171 | // actuate writes product specific files and makes product specifc API calls. |
| 172 | // It does not handle writing firebase.json and .firebaserc |
nothing calls this directly
no test coverage detected
searching dependent graphs…