Skip to content

Fix issue where projectId and displayName are not getting parsed #8635

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

Merged
merged 9 commits into from
Jun 3, 2025

Conversation

aalej
Copy link
Contributor

@aalej aalej commented May 21, 2025

Description

Fixes #8634

Scenarios Tested

with [projectId] param

$ firebase projects:create some-project-id
? What would you like to call your project? (defaults to your project ID) (some-project-id)
$ firebase projects:create some-project-id
✔ What would you like to call your project? (defaults to your project ID) some-project-id
✖ Creating Google Cloud Platform project

Error: Failed to create project because there is already a project with ID some-project-id. Please try again with a unique project ID.

with [display-name] option

$ firebase projects:create some-project-id-0123456 --display-name some-display-name
✔ Creating Google Cloud Platform project
✔ Adding Firebase resources to Google Cloud Platform project

🎉🎉🎉 Your Firebase project is ready! 🎉🎉🎉

Project information:
   - Project ID: some-project-id-0123456
   - Project Name: some-display-name

Firebase console is available at
https://console.firebase.google.com/project/some-project-id-0123456/overview

Sample Commands

firebase projects:create some-project-id

Copy link
Contributor

@joehan joehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some type nits.

@@ -41,12 +41,12 @@ function toInitProjectInfo(projectMetaData: FirebaseProjectMetadata): InitProjec
};
}

async function promptAndCreateNewProject(): Promise<FirebaseProjectMetadata> {
async function promptAndCreateNewProject(options: any): Promise<FirebaseProjectMetadata> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be options: Options, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! didn't know we had an Options type, will update!

},
});
export async function promptProjectCreation(
options: any,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, probably should use Options as the type here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like using the Options type raises and error
image

I'm guessing this is because displayName is not a property in either Options or BaseOptions, so displayName gets cast as unknown in [key: string]: unknown;

export interface BaseOptions {
cwd: string;
configPath: string;
only: string;
except: string;
config: Config;
filteredTargets: string[];
force: boolean;
// Options which are present on every command
project?: string;
projectAlias?: string;
projectId?: string;
projectNumber?: string;
projectRoot?: string;
account?: string;
json: boolean;
nonInteractive: boolean;
interactive: boolean;
debug: boolean;
rc: RC;
// Emulator specific import/export options
exportOnExit?: boolean | string;
import?: string;
isMCP?: boolean;
}
export interface Options extends BaseOptions {
// TODO(samstern): Remove this once options is better typed
[key: string]: unknown;
// whether it's coming from the VS Code Extension
isVSCE?: true;
}

Would it be okay to add displayName as a property in Options. Something like
image

@joehan joehan enabled auto-merge (squash) May 29, 2025 19:57
@joehan joehan merged commit c8dd88a into master Jun 3, 2025
48 of 50 checks passed
@joehan joehan deleted the aalej-projectscreate-parseid branch June 3, 2025 10:20
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

firebase projects:create some-project-id doesn't parse the project ID param
2 participants