Skip to content

Added validation for project id and project name - #8057

Merged
joehan merged 2 commits into
masterfrom
aalej-finit-vpid
Dec 12, 2024
Merged

Added validation for project id and project name#8057
joehan merged 2 commits into
masterfrom
aalej-finit-vpid

Conversation

@aalej

@aalej aalej commented Dec 12, 2024

Copy link
Copy Markdown
Contributor

Description

Fixes #2514

Inquirer will not accept the input until the validation passes. Instead, an error message is displayed at the bottom

Scenarios Tested

  1. Project ID too short
$ firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /Users/PATH/firebase-tools/test-apps/validate-project-id

? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. Data Connect: Set up a Firebase
 Data Connect service

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add, 
but for now we'll just set up a default project.

? Please select an option: Create a new project
i  If you want to create a project in a Google Cloud organization or folder, please use "firebase projects:create" instead, and return to this command when you've created the project.
? Please specify a unique project id (warning: cannot be modified afterward) [6-30 characters]:
 abcde
>> Project ID must be at least 6 characters long
  1. Project name too short
$ firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /Users/alejandromarco/Desktop/firebase-tools/test-apps/validate-project-id

? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. Data Connect: Set up a Firebase
 Data Connect service

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add, 
but for now we'll just set up a default project.

? Please select an option: Create a new project
i  If you want to create a project in a Google Cloud organization or folder, please use "firebase projects:create" instead, and return to this command when you've created the project.
? Please specify a unique project id (warning: cannot be modified afterward) [6-30 characters]:
 asfasf
? What would you like to call your project? (defaults to your project ID) asf
>> Project name must be at least 4 characters long

Sample Commands

@joehan
joehan enabled auto-merge (squash) December 12, 2024 22:23
@joehan
joehan merged commit 9805e5a into master Dec 12, 2024
@aalej
aalej deleted the aalej-finit-vpid branch March 25, 2025 14:17
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.

CLI errors out when project name is less than 5 chars

2 participants