Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 3 additions & 4 deletions firebase-vscode/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { registerWebhooks } from "./webhook";
import { createE2eMockable } from "../utils/test_hooks";
import { runTerminalTask } from "../data-connect/terminal";
import { AnalyticsLogger } from "../analytics";
import { EmulatorHub } from "../../../src/emulator/hub";

export async function registerCore(
broker: ExtensionBrokerImpl,
Expand Down Expand Up @@ -66,10 +67,8 @@ export async function registerCore(
);
return;
}
const initCommand = currentProjectId.value
? `${settings.firebasePath} init dataconnect --project ${currentProjectId.value}`
: `${settings.firebasePath} init dataconnect`;

const projectId = currentProjectId.value || EmulatorHub.MISSING_PROJECT_PLACEHOLDER;
const initCommand = `${settings.firebasePath} init dataconnect --project ${projectId}`;
initSpy.call("firebase init", initCommand, { focus: true });
});

Expand Down
15 changes: 7 additions & 8 deletions firebase-vscode/webviews/SidebarApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,13 @@ export function SidebarApp() {
<ConfigPicker />
</PanelSection>

{user.value &&
(isInitialized.value ? (
<Content />
) : (
<PanelSection isLast={true}>
<Welcome />
</PanelSection>
))}
{isInitialized.value ? (
<Content />
) : (
<PanelSection isLast={true}>
<Welcome />
</PanelSection>
)}
</App>
);
}
5 changes: 4 additions & 1 deletion src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { readTemplateSync } from "../templates";
import { FirebaseError } from "../error";
import { logBullet } from "../utils";
import { EmulatorHub } from "../emulator/hub";

const homeDir = os.homedir();

Expand Down Expand Up @@ -147,7 +148,6 @@
export const command = new Command("init [feature]")
.description("interactively configure the current directory as a Firebase project directory")
.help(HELP)
.before(requireAuth)
.action(initAction);

/**
Expand All @@ -164,6 +164,9 @@
".",
);
}
if (options.project !== EmulatorHub.MISSING_PROJECT_PLACEHOLDER) {
await requireAuth(options);
}

const cwd = options.cwd || process.cwd();

Expand Down Expand Up @@ -202,7 +205,7 @@

const setup: Setup = {
config: config.src,
rcfile: config.readProjectFile(".firebaserc", {

Check warning on line 208 in src/commands/init.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
json: true,
fallback: {},
}),
Expand Down
5 changes: 5 additions & 0 deletions src/init/features/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import * as utils from "../../utils";
import * as prompt from "../../prompt";
import { Options } from "../../options";
import { EmulatorHub } from "../../emulator/hub";

const OPTION_NO_PROJECT = "Don't set up a default project";
const OPTION_USE_PROJECT = "Use an existing project";
Expand Down Expand Up @@ -72,7 +73,7 @@
* @param options the Firebase CLI options object.
* @return the project metadata, or undefined if no project was selected.
*/
async function projectChoicePrompt(options: any): Promise<FirebaseProjectMetadata | undefined> {

Check warning on line 76 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
const choices = [OPTION_USE_PROJECT, OPTION_NEW_PROJECT, OPTION_ADD_FIREBASE, OPTION_NO_PROJECT];
const projectSetupOption: string = await prompt.select<(typeof choices)[number]>({
message: "Please select an option:",
Expand All @@ -81,9 +82,9 @@

switch (projectSetupOption) {
case OPTION_USE_PROJECT:
return getOrPromptProject(options);

Check warning on line 85 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe argument of type `any` assigned to a parameter of type `Partial<Options>`
case OPTION_NEW_PROJECT:
return promptAndCreateNewProject(options);

Check warning on line 87 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe argument of type `any` assigned to a parameter of type `Options`
case OPTION_ADD_FIREBASE:
return promptAndAddFirebaseToCloudProject();
default:
Expand All @@ -98,8 +99,12 @@
* @param config Configuration for the project.
* @param options Command line options.
*/
export async function doSetup(setup: any, config: any, options: any): Promise<void> {

Check warning on line 102 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 102 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type

Check warning on line 102 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

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

Check warning on line 103 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .project on an `any` value
if (options.projectId === EmulatorHub.MISSING_PROJECT_PLACEHOLDER) {

Check warning on line 104 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .projectId on an `any` value
logger.info(`Skipping Firebase project given --project=${options.projectId}`);

Check warning on line 105 in src/init/features/project.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Invalid type "any" of template literal expression
return;
}

logger.info();
logger.info(`First, let's associate this project directory with a Firebase project.`);
Expand Down
Loading