@@ -10,9 +10,9 @@ import { tryCatchAsync } from "../../tryCatchAsync.js";
10
10
import { tryCatchLazyValueAsync } from "../../tryCatchLazyValueAsync.js" ;
11
11
import { PromptedOptions } from "../../types.js" ;
12
12
import { parsePackageAuthor } from "./parsePackageAuthor.js" ;
13
- import { readDefaultsFromDevelopment } from "./readDefaultsFromDevelopment.js" ;
14
13
import { readDefaultsFromReadme } from "./readDefaultsFromReadme.js" ;
15
- import { readGitHubEmail } from "./readGitHubEmail.js" ;
14
+ import { readEmails } from "./readEmails.js" ;
15
+ import { readGuide } from "./readGuide.js" ;
16
16
17
17
export function createOptionDefaults ( promptedOptions ?: PromptedOptions ) {
18
18
const gitDefaults = tryCatchLazyValueAsync ( async ( ) =>
@@ -34,38 +34,21 @@ export function createOptionDefaults(promptedOptions?: PromptedOptions) {
34
34
( await packageAuthor ( ) ) . author ?? ( await npmDefaults ( ) ) ?. name ,
35
35
bin : async ( ) => ( await packageData ( ) ) . bin ,
36
36
description : async ( ) => ( await packageData ( ) ) . description ,
37
- email : async ( ) => {
38
- const githubEmail =
39
- ( await readGitHubEmail ( ) ) ??
40
- ( await tryCatchAsync (
41
- async ( ) => ( await $ `git config --get user.email` ) . stdout ,
42
- ) ) ;
43
- const npmEmail =
44
- ( await npmDefaults ( ) ) ?. email ?? ( await packageAuthor ( ) ) . email ;
45
-
46
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
47
- return githubEmail || npmEmail
48
- ? {
49
- github : ( githubEmail || npmEmail ) ! ,
50
- npm : ( npmEmail || githubEmail ) ! ,
51
- }
52
- : undefined ;
53
- /* eslint-enable @typescript-eslint/no-non-null-assertion */
54
- } ,
37
+ email : async ( ) => readEmails ( npmDefaults , packageAuthor ) ,
55
38
funding : async ( ) =>
56
39
await tryCatchAsync ( async ( ) =>
57
40
( await fs . readFile ( ".github/FUNDING.yml" ) )
58
41
. toString ( )
59
42
. split ( ":" ) [ 1 ]
60
43
?. trim ( ) ,
61
44
) ,
45
+ guide : readGuide ,
62
46
owner : async ( ) =>
63
47
( await gitDefaults ( ) ) ?. organization ?? ( await packageAuthor ( ) ) . author ,
64
48
repository : async ( ) =>
65
49
promptedOptions ?. repository ??
66
50
( await gitDefaults ( ) ) ?. name ??
67
51
( await packageData ( ) ) . name ,
68
- ...readDefaultsFromDevelopment ( ) ,
69
52
...readDefaultsFromReadme ( ) ,
70
53
} ;
71
54
}
0 commit comments