Skip to content

Commit

Permalink
added validation for project id and project name (#8057)
Browse files Browse the repository at this point in the history
Co-authored-by: joehan <[email protected]>
  • Loading branch information
aalej and joehan authored Dec 12, 2024
1 parent 4f50803 commit 9805e5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
- CF3 callables can now be annotate with a genkit action they are serving. (#8039)
- HTTPS functions can now be upgraded to HTTPS Callable functions. (#8039)
- Update default tsconfig to support more modern defaults. (#8039)
- Added validation for project ID and project name during `firebase init` (#2514)
- Update the Firebase Data Connect local toolkit to v1.7.5, which includes a fix for Kotlin codegen that ensures that generated XxxKeys.kt files include the required `@file:UseSerializers(UUIDSerializer::class)` annotation. (#8058)
20 changes: 19 additions & 1 deletion src/management/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,30 @@ export const PROJECTS_CREATE_QUESTIONS: Question[] = [
message:
"Please specify a unique project id " +
`(${clc.yellow("warning")}: cannot be modified afterward) [6-30 characters]:\n`,
validate: (projectId: string) => {
if (projectId.length < 6) {
return "Project ID must be at least 6 characters long";
} else if (projectId.length > 30) {
return "Project ID cannot be longer than 30 characters";
} else {
return true;
}
},
},
{
type: "input",
name: "displayName",
default: "",
default: (answers: any) => answers.projectId,
message: "What would you like to call your project? (defaults to your project ID)",
validate: (displayName: string) => {
if (displayName.length < 4) {
return "Project name must be at least 4 characters long";
} else if (displayName.length > 30) {
return "Project name cannot be longer than 30 characters";
} else {
return true;
}
},
},
];

Expand Down

0 comments on commit 9805e5a

Please sign in to comment.