@@ -39,11 +39,11 @@ async function installDependencies(dirName) {
39
39
40
40
async function initGit ( dirName ) {
41
41
console . log ( `Setting up Git ...` )
42
- await fs . remove ( ` ${ dirName } / .git` , { recursive : true } , async ( ) => {
43
- await run (
44
- `cd ${ dirName } && git init && git add . && git commit -m "New Stackbit project"`
45
- )
46
- } )
42
+ // remove .git folder
43
+ await fs . removeSync ( ` ${ dirName } / .git` )
44
+ await run (
45
+ `cd ${ dirName } && git init && git add . && git commit -m "New Stackbit project"`
46
+ )
47
47
}
48
48
/**
49
49
* Given a version string, compare it to a control version. Returns:
@@ -160,29 +160,19 @@ async function cloneExample() {
160
160
// Checkout just the example dir.
161
161
await run ( `cd ${ tmpDir } && git sparse-checkout set ${ args . example } ` )
162
162
163
- // Copy out into a new directory within current working directory.
164
- await fs . copy ( `${ tmpDir } /${ args . example } ` , dirName , async ( err ) => {
165
- if ( err ) {
166
- console . log ( err )
167
- }
168
- } )
163
+ // move out into a new directory.
164
+ await fs . moveSync ( `${ tmpDir } /${ args . example } ` , dirName )
169
165
170
166
// Delete the clone.
171
- await fs . remove ( tmpDir , { recursive : true } , ( err ) => {
172
- if ( err ) {
173
- console . log ( err )
174
- }
175
- } )
176
-
177
- if ( fs . existsSync ( path . join ( process . cwd ( ) , dirName ) ) )
178
- await installDependencies ( path . join ( process . cwd ( ) , dirName ) )
167
+ await fs . removeSync ( tmpDir )
168
+
169
+ await installDependencies ( dirName )
179
170
// Project Setup
180
- // await
181
- // await initGit(prestineFolder)
171
+ await initGit ( dirName )
182
172
} catch ( err ) {
183
-
184
173
if ( fs . existsSync ( dirName ) ) await fs . remove ( dirName )
185
174
if ( fs . existsSync ( tmpDir ) )
175
+ // remove temp directory
186
176
await fs . remove ( tmpDir , ( err ) => {
187
177
if ( err ) {
188
178
console . log ( err )
0 commit comments