Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bee76a0

Browse files
fix: fix --force feature when targetDir doesn't exist yet
1 parent 0478ba0 commit bee76a0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ function canSafelyOverwrite(dir) {
3333
}
3434

3535
function emptyDir(dir) {
36+
if (!fs.existsSync(dir)) {
37+
return
38+
}
39+
3640
postOrderDirectoryTraverse(
3741
dir,
3842
(dir) => fs.rmdirSync(dir),
@@ -237,7 +241,7 @@ async function init() {
237241
const needsCypressCT = needsCypress && !needsVitest
238242
const root = path.join(cwd, targetDir)
239243

240-
if (shouldOverwrite) {
244+
if (fs.existsSync(root)&&shouldOverwrite) {
241245
emptyDir(root)
242246
} else if (!fs.existsSync(root)) {
243247
fs.mkdirSync(root)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /