@@ -10,17 +10,18 @@ module.exports = class extends Generator {
1010 this . log ( yosay ( `Welcome to the ${ chalk . red ( pkg . name ) } generator!` ) ) ;
1111
1212 const appName = changeCase . paramCase ( this . appname ) ;
13- const gitName = this . user . git . name ( ) || 'organization' ;
14- const gitEmail = this . user . git . email ( ) || 'hi@domain.com' ;
15- const githubUsername = await ( async ( ) => {
13+ const organizationName = await ( async ( ) => {
1614 try {
1715 const username = await this . user . github . username ( ) ;
1816
1917 return username ;
2018 } catch ( err ) {
21- return gitName ;
19+ return 'organization-name' ;
2220 }
2321 } ) ( ) ;
22+ const gitName = this . user . git . name ( ) || organizationName ;
23+ const gitEmail =
24+ this . user . git . email ( ) || `my-email@${ organizationName } .com` ;
2425 const prompts = [
2526 {
2627 type : 'input' ,
@@ -36,32 +37,26 @@ module.exports = class extends Generator {
3637 } ,
3738 {
3839 type : 'input' ,
39- name : 'elementHomepage' ,
40- message : 'Homepage?' ,
41- default : `https://github.com/${ githubUsername } /${ appName } ` ,
42- } ,
43- {
44- type : 'input' ,
45- name : 'elementBugs' ,
46- message : 'Bugs tracker?' ,
47- default : `https://github.com/${ githubUsername } /${ appName } /issues` ,
40+ name : 'elementOrganizationName' ,
41+ message : 'GitHub organization name?' ,
42+ default : organizationName ,
4843 } ,
4944 {
5045 type : 'input' ,
5146 name : 'elementAuthor' ,
5247 message : 'Author?' ,
5348 default : `${ gitName } \<${ gitEmail } \>` ,
5449 } ,
55- {
56- type : 'input' ,
57- name : 'elementRepository' ,
58- message : 'Repository?' ,
59- default : `https://github.com/${ githubUsername } /${ appName } .git` ,
60- } ,
6150 ] ;
6251
6352 return this . prompt ( prompts ) . then ( ( props ) => {
64- this . props = props ;
53+ this . props = {
54+ ...props ,
55+ elementName : changeCase . paramCase ( props . elementName ) ,
56+ elementOrganizationName : changeCase . paramCase (
57+ props . elementOrganizationName ,
58+ ) ,
59+ } ;
6560 } ) ;
6661 }
6762
0 commit comments