File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,7 @@ async function installDependencies(dirName) {
3939
4040async function initGit ( dirName ) {
4141 console . log ( `Setting up Git ...` ) ;
42- // remove .git folder
43- await fs . removeSync ( `${ dirName } / .git` ) ;
42+ await fs . removeSync ( `${ dirName } /.git` ) ;
4443 await run ( `cd ${ dirName } && git init && git add . && git commit -m "New Stackbit project"` ) ;
4544}
4645/**
@@ -148,25 +147,18 @@ async function cloneExample() {
148147 await run ( `git clone --depth 1 --filter=blob:none --sparse ${ config . examples . repoUrl } ${ tmpDir } ` ) ;
149148 // Checkout just the example dir.
150149 await run ( `cd ${ tmpDir } && git sparse-checkout set ${ args . example } ` ) ;
151-
152150 // move out into a new directory.
153151 await fs . moveSync ( `${ tmpDir } /${ args . example } ` , dirName ) ;
154-
155152 // Delete the clone.
156153 await fs . removeSync ( tmpDir ) ;
157154
158155 // Project Setup
159156 await installDependencies ( dirName ) ;
160157 await initGit ( dirName ) ;
161158 } catch ( err ) {
162- if ( fs . existsSync ( dirName ) ) await fs . remove ( dirName ) ;
163- if ( fs . existsSync ( tmpDir ) )
164- // remove temp directory
165- await fs . remove ( tmpDir , ( err ) => {
166- if ( err ) {
167- console . log ( err ) ;
168- }
169- } ) ;
159+ console . error ( err ) ;
160+ if ( fs . existsSync ( dirName ) ) await fs . removeSync ( dirName ) ;
161+ if ( fs . existsSync ( tmpDir ) ) await fs . removeSync ( tmpDir ) ;
170162 process . exit ( 1 ) ;
171163 }
172164
You can’t perform that action at this time.
0 commit comments