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
9 changes: 8 additions & 1 deletion src/init/features/apphosting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
export async function doSetup(setup: Setup, config: Config, options: Options): Promise<void> {
// Use dynamicImport to bypass Node ESM linkage cycles during mocha test loading.
const { dynamicImport } = eval("require")("../../dynamicImport");

Check warning on line 34 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe call of an `any` typed value

Check warning on line 34 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value

const projectId = setup.projectId as string;

Expand Down Expand Up @@ -91,8 +91,8 @@
utils.logWarning(`Firebase web app not set`);
}

const prompts = await dynamicImport("./apphosting/prompts");

Check warning on line 94 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe call of an `any` typed value

Check warning on line 94 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value
const runtime = await prompts.resolveRuntime(projectId, location, options.nonInteractive);

Check warning on line 95 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe call of an `any` typed value

Check warning on line 95 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe member access .resolveRuntime on an `any` value

Check warning on line 95 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe assignment of an `any` value

const createBackendSpinner = ora("Creating your new backend...").start();
const backend = await createBackend(
Expand All @@ -103,7 +103,7 @@
/* repository= */ undefined,
webApp?.id,
/* rootDir= */ "/",
runtime,

Check warning on line 106 in src/init/features/apphosting.ts

View workflow job for this annotation

GitHub Actions / lint (24)

Unsafe argument of type `any` assigned to a parameter of type `string | undefined`
);

createBackendSpinner.succeed(`Successfully created backend!\n\t${backend.name}\n`);
Expand All @@ -113,13 +113,20 @@
backendConfig.rootDir = await input({
default: "/",
message: "Specify your app's root directory relative to your firebase.json directory",
validate: (input: string) => {
const absPath = path.join(config.projectDir, input);
if (!existsSync(absPath)) {
return `Directory ${absPath} does not exist. Please enter a valid directory.`;
}
return true;
},
});

upsertAppHostingConfig(backendConfig, config);
config.writeProjectFile("firebase.json", config.src);

utils.logBullet("Writing default settings to " + clc.bold("apphosting.yaml") + "...");
const absRootDir = path.join(process.cwd(), backendConfig.rootDir);
const absRootDir = path.join(config.projectDir, backendConfig.rootDir);
if (!existsSync(absRootDir)) {
throw new FirebaseError(
`Failed to write apphosting.yaml file because app root directory ${absRootDir} does not exist. Please try again with a valid directory.`,
Expand Down
Loading