Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default FDC Service ID to the folder name #7715

Merged
merged 2 commits into from
Sep 23, 2024
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
4 changes: 2 additions & 2 deletions src/init/features/dataconnect/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from "path";
import { join, basename } from "path";
import * as clc from "colorette";

import { confirm, promptOnce } from "../../../prompt";
Expand Down Expand Up @@ -64,7 +64,7 @@
};

// doSetup is split into 2 phases - ask questions and then actuate files and API calls based on those answers.
export async function doSetup(setup: Setup, config: Config): Promise<void> {

Check warning on line 67 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
const info = await askQuestions(setup, config);
await actuate(setup, config, info);
logger.info("");
Expand Down Expand Up @@ -125,7 +125,7 @@

// actuate writes product specific files and makes product specifc API calls.
// It does not handle writing firebase.json and .firebaserc
export async function actuate(setup: Setup, config: Config, info: RequiredInfo) {

Check warning on line 128 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function

Check warning on line 128 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing JSDoc comment
await writeFiles(config, info);

if (setup.projectId && info.shouldProvisionCSQL) {
Expand All @@ -140,8 +140,8 @@
}
}

async function writeFiles(config: Config, info: RequiredInfo) {

Check warning on line 143 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
const dir: string = config.get("dataconnect.source") || "dataconnect";

Check warning on line 144 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
console.log(dir);
const subbedDataconnectYaml = subDataconnectYamlValues({
...info,
Expand All @@ -166,7 +166,7 @@
}
}

async function writeConnectorFiles(

Check warning on line 169 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
config: Config,
connectorInfo: {
id: string;
Expand All @@ -175,7 +175,7 @@
},
) {
const subbedConnectorYaml = subConnectorYamlValues({ connectorId: connectorInfo.id });
const dir: string = config.get("dataconnect.source") || "dataconnect";

Check warning on line 178 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
await config.askWriteProjectFile(
join(dir, connectorInfo.path, "connector.yaml"),
subbedConnectorYaml,
Expand Down Expand Up @@ -239,7 +239,7 @@
}),
);
if (existingServicesAndSchemas.length) {
const choices: { name: string; value: any }[] = existingServicesAndSchemas.map((s) => {

Check warning on line 242 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
const serviceName = parseServiceName(s.service.name);
return {
name: `${serviceName.location}/${serviceName.serviceId}`,
Expand All @@ -247,7 +247,7 @@
};
});
choices.push({ name: "Create a new service", value: undefined });
const choice: { service: Service; schema: Schema } = await promptOnce({

Check warning on line 250 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
message:
"Your project already has existing services. Which would you like to set up local files for?",
type: "list",
Expand Down Expand Up @@ -275,7 +275,7 @@
]);
if (connectors.length) {
info.connectors = connectors.map((c) => {
const id = c.name.split("/").pop()!;

Check warning on line 278 in src/init/features/dataconnect/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Forbidden non-null assertion
return {
id,
path: connectors.length === 1 ? "./connector" : `./${id}`,
Expand All @@ -295,7 +295,7 @@
info.serviceId = await promptOnce({
message: "What ID would you like to use for this service?",
type: "input",
default: "app",
default: basename(process.cwd()),
});
}
return info;
Expand Down
Loading