Skip to content

Commit 3eef9d3

Browse files
committed
fixes
1 parent 626866a commit 3eef9d3

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

index.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ async function installDependencies(dirName) {
3939

4040
async 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

0 commit comments

Comments
 (0)