Skip to content

Fixed issue where firebase init hosting re-prompts for source #8617

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fixed issue where, with `webframeworks` enabled, `firebase init hosting` re-prompts users for source. (#8587)
6 changes: 3 additions & 3 deletions src/init/features/hosting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
* Does the setup steps for Firebase Hosting.
* WARNING: #6527 - `options` may not have all the things you think it does.
*/
export async function doSetup(setup: any, config: any, options: Options): Promise<void> {

Check warning on line 26 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 26 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
setup.hosting = {};

Check warning on line 27 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .hosting on an `any` value

// There's a path where we can set up Hosting without a project, so if
// if setup.projectId is empty, we don't do any checking for a Hosting site.
if (setup.projectId) {

Check warning on line 31 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .projectId on an `any` value
let hasHostingSite = true;
try {
await getDefaultHostingSite({ projectId: setup.projectId });

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

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .projectId on an `any` value

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

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
} catch (err: unknown) {
if (err !== errNoDefaultSite) {
throw err;
Expand All @@ -48,7 +48,7 @@
});
if (confirmCreate) {
const createOptions = {
projectId: setup.projectId,

Check warning on line 51 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .projectId on an `any` value

Check warning on line 51 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
nonInteractive: options.nonInteractive,
};
const newSite = await interactiveCreateHostingSite("", "", createOptions);
Expand All @@ -60,13 +60,13 @@
}

let discoveredFramework = experiments.isEnabled("webframeworks")
? await discover(config.projectDir, false)

Check warning on line 63 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .projectDir on an `any` value

Check warning on line 63 in src/init/features/hosting/index.ts

View workflow job for this annotation

GitHub Actions / lint (20)

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

if (experiments.isEnabled("webframeworks")) {
if (discoveredFramework) {
const name = WebFrameworks[discoveredFramework.framework].name;
setup.hosting.useDiscoveredFramework = await confirm({
setup.hosting.useDiscoveredFramework ??= await confirm({
message: `Detected an existing ${name} codebase in the current directory, should we use this?`,
default: true,
});
Expand All @@ -82,7 +82,7 @@
}

if (setup.hosting.useWebFrameworks) {
setup.hosting.source = await input({
setup.hosting.source ??= await input({
message: "What folder would you like to use for your web application's root directory?",
default: "hosting",
});
Expand All @@ -92,7 +92,7 @@

if (discoveredFramework) {
const name = WebFrameworks[discoveredFramework.framework].name;
setup.hosting.useDiscoveredFramework = await confirm({
setup.hosting.useDiscoveredFramework ??= await confirm({
message: `Detected an existing ${name} codebase in ${setup.hosting.source}, should we use this?`,
default: true,
});
Expand Down
Loading