@@ -12,9 +12,12 @@ export interface OtiAnswers {
1212 features : string [ ] ;
1313}
1414
15- function saver ( fieldName : string ) {
15+ function saver ( fieldName : string , required : boolean ) {
1616 return ( value : string ) => {
1717 config . set ( fieldName , value ) ;
18+ if ( required ) {
19+ return value ?. trim ( ) ? true : 'This field is required' ;
20+ }
1821 return true ;
1922 } ;
2023}
@@ -45,21 +48,21 @@ export const Prompts: Record<string, PromptQuestion> = {
4548 type : 'input' ,
4649 name : 'email' ,
4750 message : 'What is the developer email address for package.json?' ,
48- validate : saver ( 'email' ) ,
51+ validate : saver ( 'email' , false ) ,
4952 default : config . get ( 'email' ) || gitConfig ?. user ?. email ,
5053 } ,
5154 fullname : {
5255 type : 'input' ,
5356 name : 'fullname' ,
5457 message : 'What is the developer name for package.json?' ,
55- validate : saver ( 'fullname' ) ,
58+ validate : saver ( 'fullname' , false ) ,
5659 default : config . get ( 'fullname' ) || gitConfig ?. user ?. name ,
5760 } ,
5861 org : {
5962 type : 'input' ,
6063 name : 'org' ,
6164 message : 'What is the name of your github organization or your github username?' ,
62- validate : saver ( 'org' ) ,
65+ validate : saver ( 'org' , true ) ,
6366 default : config . get ( 'org' ) ,
6467 } ,
6568 name : {
0 commit comments