@@ -21,7 +21,17 @@ const templateSettings = require('./templates/default.json')
21
21
const ssrTemplateSettings = require ( './templates/default-ssr.json' )
22
22
const staticTemplateSettings = require ( './templates/default-static.json' )
23
23
24
- const createApp = async ( { appPath, useNpm, noGit = false , isStatic, example } ) => {
24
+ const createApp = async ( {
25
+ appPath,
26
+ example,
27
+ gitRemote,
28
+ isStatic,
29
+ noGit = false ,
30
+ useNpm
31
+ } ) => {
32
+ const root = path . resolve ( appPath )
33
+ const appName = path . basename ( root )
34
+
25
35
if ( example ) {
26
36
const found = await hasExample ( example )
27
37
if ( ! found ) {
@@ -34,8 +44,6 @@ const createApp = async ({ appPath, useNpm, noGit = false, isStatic, example })
34
44
}
35
45
}
36
46
37
- const root = path . resolve ( appPath )
38
- const appName = path . basename ( root )
39
47
const version = '0.1.0'
40
48
41
49
await makeDir ( root )
@@ -54,7 +62,6 @@ const createApp = async ({ appPath, useNpm, noGit = false, isStatic, example })
54
62
await makeDir ( root )
55
63
process . chdir ( root )
56
64
57
- const gitRemote = `git+ssh://[email protected] /amclin/${ appName } .git`
58
65
const homepage = `https://github.com/amclin/${ appName } `
59
66
const author = userName ( )
60
67
const year = new Date ( ) . getFullYear ( )
@@ -103,9 +110,7 @@ const createApp = async ({ appPath, useNpm, noGit = false, isStatic, example })
103
110
url : `${ homepage } /issues`
104
111
}
105
112
} ,
106
- ( isStatic ) ?
107
- staticTemplateSettings . package :
108
- ssrTemplateSettings . package
113
+ isStatic ? staticTemplateSettings . package : ssrTemplateSettings . package
109
114
)
110
115
111
116
fs . writeFileSync (
@@ -142,11 +147,8 @@ const createApp = async ({ appPath, useNpm, noGit = false, isStatic, example })
142
147
} )
143
148
log ( )
144
149
145
- const copyTemplateFiles = ( dir ) => {
146
- return cpy ( [
147
- '**' ,
148
- '.dependabot/**'
149
- ] , root , {
150
+ const copyTemplateFiles = dir => {
151
+ return cpy ( [ '**' , '.dependabot/**' ] , root , {
150
152
parents : true ,
151
153
cwd : path . join ( __dirname , 'templates' , dir ) ,
152
154
rename : name => {
@@ -170,11 +172,7 @@ const createApp = async ({ appPath, useNpm, noGit = false, isStatic, example })
170
172
// For sites with server-side React (not staticly generated)
171
173
// We need a different docker file and different build
172
174
// instructions
173
- await copyTemplateFiles (
174
- ( isStatic ) ?
175
- 'default-static' :
176
- 'default-ssr'
177
- )
175
+ await copyTemplateFiles ( isStatic ? 'default-static' : 'default-ssr' )
178
176
179
177
await populateProject ( { root, appName, homepage, author, year } )
180
178
}
0 commit comments