@@ -20,6 +20,7 @@ type Config = {
20
20
githubRepository : string
21
21
githubPagesOrigin : string
22
22
docsBase : string
23
+ homepageUrl : string
23
24
includeDocs : boolean
24
25
includeGithubPages : boolean
25
26
includePlayground : boolean
@@ -119,6 +120,7 @@ async function init() {
119
120
const githubRepository = githubPath ? `git+${ githubUrl } .git` : ''
120
121
const githubPagesOrigin = githubUserName && result . includeGithubPages ? `https://${ githubUserName } .github.io` : ''
121
122
const docsBase = githubRepoName && result . includeGithubPages ? `/${ githubRepoName } /` : '/'
123
+ const homepageUrl = githubPagesOrigin && result . includeGithubPages ? `${ githubPagesOrigin } ${ docsBase } ` : githubUrl
122
124
123
125
const targetDirPath = path . join ( cwd , targetDirName )
124
126
@@ -146,6 +148,7 @@ async function init() {
146
148
githubRepository,
147
149
githubPagesOrigin,
148
150
docsBase,
151
+ homepageUrl,
149
152
includeDocs : result . includeDocs ,
150
153
includeGithubPages : ! ! result . includeGithubPages ,
151
154
includePlayground : result . includePlayground ,
@@ -227,12 +230,7 @@ function copyFiles(templateFile: string, config: Config) {
227
230
const template = fs . readFileSync ( templatePath , 'utf-8' )
228
231
const content = template
229
232
. replace ( / @ p r o j e c t N a m e @ / g, config . shortUnscopedPackageName )
230
- . replace ( / @ u n s c o p e d P a c k a g e N a m e @ / g, config . unscopedPackageName )
231
- . replace ( / @ g l o b a l V a r i a b l e N a m e @ / g, config . globalVariableName )
232
- . replace ( / @ s c o p e d P a c k a g e N a m e @ / g, config . scopedPackageName )
233
- . replace ( / @ g i t h u b U r l @ / g, config . githubUrl )
234
- . replace ( / @ g i t h u b I s s u e s @ / g, config . githubIssues )
235
- . replace ( / @ g i t h u b R e p o s i t o r y @ / g, config . githubRepository )
233
+ . replace ( new RegExp ( `@(${ Object . keys ( config ) . join ( '|' ) } )@` , 'g' ) , ( all , setting ) => config [ setting ] ?? all )
236
234
237
235
fs . writeFileSync ( targetPath , content )
238
236
} else {
0 commit comments