@@ -20,6 +20,7 @@ type Config = {
2020 githubRepository : string
2121 githubPagesOrigin : string
2222 docsBase : string
23+ homepageUrl : string
2324 includeDocs : boolean
2425 includeGithubPages : boolean
2526 includePlayground : boolean
@@ -119,6 +120,7 @@ async function init() {
119120 const githubRepository = githubPath ? `git+${ githubUrl } .git` : ''
120121 const githubPagesOrigin = githubUserName && result . includeGithubPages ? `https://${ githubUserName } .github.io` : ''
121122 const docsBase = githubRepoName && result . includeGithubPages ? `/${ githubRepoName } /` : '/'
123+ const homepageUrl = githubPagesOrigin && result . includeGithubPages ? `${ githubPagesOrigin } ${ docsBase } ` : githubUrl
122124
123125 const targetDirPath = path . join ( cwd , targetDirName )
124126
@@ -146,6 +148,7 @@ async function init() {
146148 githubRepository,
147149 githubPagesOrigin,
148150 docsBase,
151+ homepageUrl,
149152 includeDocs : result . includeDocs ,
150153 includeGithubPages : ! ! result . includeGithubPages ,
151154 includePlayground : result . includePlayground ,
@@ -227,12 +230,7 @@ function copyFiles(templateFile: string, config: Config) {
227230 const template = fs . readFileSync ( templatePath , 'utf-8' )
228231 const content = template
229232 . 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 )
236234
237235 fs . writeFileSync ( targetPath , content )
238236 } else {
0 commit comments