From 3487624ac014b90bb21fe7431e527d70f83d2171 Mon Sep 17 00:00:00 2001 From: Oj Date: Sun, 7 Mar 2021 20:13:00 +0000 Subject: [PATCH] [Base] Force rm clone dir if exists --- src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index f887244..cb7edbb 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ import Parcel from 'parcel-bundler'; import axios from 'axios'; import glob from 'glob'; -import { rmSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, existsSync } from 'fs'; +import { rmSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, existsSync, rmdirSync } from 'fs'; import { createHash } from 'crypto'; import { dirname } from 'path'; @@ -129,6 +129,8 @@ for (const parentRepo of ModuleRepos) { // resetDir(cloneDir); // rmSync(cloneDir, { recursive: true, force: true }); + + if (existsSync(cloneDir)) rmSync(cloneDir, { recursive: true, force: true }); await new Promise((res) => exec(`git clone ${url} ${cloneDir}`, res));