Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
--force
1 parent 0478ba0 commit bee76a0Copy full SHA for bee76a0
index.js
@@ -33,6 +33,10 @@ function canSafelyOverwrite(dir) {
33
}
34
35
function emptyDir(dir) {
36
+ if (!fs.existsSync(dir)) {
37
+ return
38
+ }
39
+
40
postOrderDirectoryTraverse(
41
dir,
42
(dir) => fs.rmdirSync(dir),
@@ -237,7 +241,7 @@ async function init() {
237
241
const needsCypressCT = needsCypress && !needsVitest
238
242
const root = path.join(cwd, targetDir)
239
243
240
- if (shouldOverwrite) {
244
+ if (fs.existsSync(root) && shouldOverwrite) {
245
emptyDir(root)
246
} else if (!fs.existsSync(root)) {
247
fs.mkdirSync(root)
0 commit comments