Skip to content

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

Merged
joehan merged 9 commits into
masterfrom
aalej-projectscreate-parseid
Jun 3, 2025
Merged

joehan merged 9 commits into
masterfrom
aalej-projectscreate-parseid

Conversation

@aalej

@aalej aalej commented May 21, 2025 •

Copy link
Copy Markdown
Contributor

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

@joehan joehan left a comment

Copy link
Copy Markdown
Member

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.

Comment thread src/init/features/project.ts Outdated
}

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

Copy link
Copy Markdown
Member

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
Copy Markdown
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!

Comment thread src/management/projects.ts Outdated
},
});
export async function promptProjectCreation(
options: any,

Copy link
Copy Markdown
Member

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
Copy Markdown
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
@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