Skip to content

Commit 90bf0fd

Browse files
committed
set default template in the end
1 parent 36f4325 commit 90bf0fd

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/init/features/dataconnect/index.ts

+8-12
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ export async function askQuestions(setup: Setup): Promise<void> {
8888
isNewInstance: false,
8989
cloudSqlDatabase: "",
9090
isNewDatabase: false,
91-
connectors: [defaultConnector],
92-
schemaGql: [defaultSchema],
91+
connectors: [],
92+
schemaGql: [],
9393
shouldProvisionCSQL: false,
9494
};
9595
// Query backend and pick up any existing services quickly.
@@ -147,6 +147,12 @@ export async function actuate(setup: Setup, config: Config): Promise<void> {
147147
info.cloudSqlInstanceId || `${info.serviceId.toLowerCase() || "app"}-fdc`;
148148
info.locationId = info.locationId || `us-central1`;
149149
info.cloudSqlDatabase = info.cloudSqlDatabase || `fdcdb`;
150+
// Make sure to add add some GQL files.
151+
// Use the template if the existing service is empty (no schema / connector GQL).
152+
if (!info.schemaGql.length && !info.connectors.flatMap((r) => r.files).length) {
153+
info.schemaGql = [defaultSchema];
154+
info.connectors = [defaultConnector];
155+
}
150156

151157
await writeFiles(config, info);
152158

@@ -182,16 +188,6 @@ async function writeFiles(config: Config, info: RequiredInfo) {
182188
...info,
183189
connectorDirs: info.connectors.map((c) => c.path),
184190
});
185-
// If we are starting from a fresh project without data connect,
186-
if (!config.get("dataconnect.source")) {
187-
// Make sure to add add some GQL files.
188-
// Use the template if the existing service is empty (no schema / connector GQL).
189-
if (!info.schemaGql.length && !info.connectors.flatMap((r) => r.files).length) {
190-
info.schemaGql = [defaultSchema];
191-
info.connectors = [defaultConnector];
192-
}
193-
}
194-
195191
config.set("dataconnect", { source: dir });
196192
await config.askWriteProjectFile(
197193
join(dir, "dataconnect.yaml"),

0 commit comments

Comments
 (0)