Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/init/features/dataconnect/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
displayIOSWarning: boolean;
};

export async function askQuestions(setup: Setup): Promise<void> {

Check warning on line 55 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const info: SdkRequiredInfo = {
apps: [],
};
Expand Down Expand Up @@ -100,7 +100,7 @@
setup.featureInfo.dataconnectSdk = info;
}

export async function chooseApp(): Promise<App[]> {

Check warning on line 103 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
let apps = dedupeAppsByPlatformAndDirectory(await detectApps(cwd));
if (apps.length) {
logLabeledSuccess(
Expand Down Expand Up @@ -148,6 +148,12 @@
const pickedApps = await checkbox<App>({
message: "Which apps do you want to set up Data Connect SDKs in?",
choices,
validate: (choices) => {
if (choices.length === 0) {
return "Please choose at least one app.";
}
return true;
},
});
if (!pickedApps || !pickedApps.length) {
throw new FirebaseError("Command Aborted. Please choose at least one app.");
Expand All @@ -157,7 +163,7 @@
return apps;
}

export async function actuate(setup: Setup, config: Config) {

Check warning on line 166 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment

Check warning on line 166 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
const sdkInfo = setup.featureInfo?.dataconnectSdk;
if (!sdkInfo) {
throw new Error("Data Connect SDK feature RequiredInfo is not provided");
Expand Down Expand Up @@ -188,7 +194,7 @@
}
}

export function initAppCounters(info: SdkRequiredInfo): { [key: string]: number } {

Check warning on line 197 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const counts = {
num_web_apps: 0,
num_android_apps: 0,
Expand Down Expand Up @@ -219,7 +225,7 @@
return counts;
}

async function actuateWithInfo(setup: Setup, config: Config, info: SdkRequiredInfo) {

Check warning on line 228 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
if (!info.apps.length) {
// If no apps is specified, try to detect it again.
// In `firebase init dataconnect:sdk`, customer may create the app while the command is running.
Expand Down Expand Up @@ -261,8 +267,8 @@
configDir: connectorInfo.directory,
account,
});
} catch (e: any) {

Check warning on line 270 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
logLabeledError("dataconnect", `Failed to generate Data Connect SDKs\n${e?.message}`);

Check warning on line 271 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .message on an `any` value

Check warning on line 271 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression
}

logLabeledSuccess(
Expand Down Expand Up @@ -301,7 +307,7 @@
* and short-circuit the prompt.
*
* `FDC_CONNECTOR` should have the same `<location>/<serviceId>/<connectorId>`.
* @param choices

Check warning on line 310 in src/init/features/dataconnect/sdk.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Expected @param names to be "setup, config". Got "choices"
*/
async function chooseExistingConnector(setup: Setup, config: Config): Promise<ConnectorInfo> {
const serviceInfos = await loadAll(setup.projectId || "", config);
Expand Down
Loading