@@ -3,7 +3,7 @@ import * as clc from "colorette";
33import { Command } from "../command" ;
44import { Options } from "../options" ;
55import { DataConnectEmulator } from "../emulator/dataconnectEmulator" ;
6- import { needProjectId } from "../projectUtils" ;
6+ import { getProjectId } from "../projectUtils" ;
77import { loadAll } from "../dataconnect/load" ;
88import { getProjectDefaultAccount } from "../auth" ;
99import { logBullet , logLabeledSuccess , logWarning } from "../utils" ;
@@ -14,6 +14,7 @@ import * as dataconnectInit from "../init/features/dataconnect";
1414import * as dataconnectSdkInit from "../init/features/dataconnect/sdk" ;
1515import { FirebaseError } from "../error" ;
1616import { postInitSaves } from "./init" ;
17+ import { EmulatorHub } from "../emulator/hub" ;
1718
1819type GenerateOptions = Options & { watch ?: boolean } ;
1920
@@ -24,7 +25,7 @@ export const command = new Command("dataconnect:sdk:generate")
2425 "watch for changes to your connector GQL files and regenerate your SDKs when updates occur" ,
2526 )
2627 . action ( async ( options : GenerateOptions ) => {
27- const projectId = needProjectId ( options ) ;
28+ const projectId = getProjectId ( options ) ;
2829
2930 let justRanInit = false ;
3031 let config = options . config ;
@@ -44,7 +45,11 @@ export const command = new Command("dataconnect:sdk:generate")
4445 }
4546 const setup : Setup = {
4647 config : config . src ,
48+ projectId : projectId ,
4749 rcfile : options . rc . data ,
50+ featureInfo : {
51+ dataconnectSource : "gen_sdk_init" ,
52+ } ,
4853 instructions : [ ] ,
4954 } ;
5055 await dataconnectInit . askQuestions ( setup ) ;
@@ -67,7 +72,11 @@ export const command = new Command("dataconnect:sdk:generate")
6772 ) ;
6873 const setup : Setup = {
6974 config : config . src ,
75+ projectId : projectId ,
7076 rcfile : options . rc . data ,
77+ featureInfo : {
78+ dataconnectSource : "gen_sdk_init_sdk" ,
79+ } ,
7180 instructions : [ ] ,
7281 } ;
7382 await dataconnectSdkInit . askQuestions ( setup ) ;
@@ -79,8 +88,11 @@ export const command = new Command("dataconnect:sdk:generate")
7988 await generateSDKsInAll ( options , serviceInfosWithSDKs , justRanInit ) ;
8089 } ) ;
8190
82- async function loadAllWithSDKs ( projectId : string , config : Config ) : Promise < ServiceInfo [ ] > {
83- const serviceInfos = await loadAll ( projectId , config ) ;
91+ async function loadAllWithSDKs (
92+ projectId : string | undefined ,
93+ config : Config ,
94+ ) : Promise < ServiceInfo [ ] > {
95+ const serviceInfos = await loadAll ( projectId || EmulatorHub . MISSING_PROJECT_PLACEHOLDER , config ) ;
8496 return serviceInfos . filter ( ( serviceInfo ) =>
8597 serviceInfo . connectorInfo . some ( ( c ) => {
8698 return (
0 commit comments