Skip to content

Commit

Permalink
custom error: when you installing the same folder and the folder alr…
Browse files Browse the repository at this point in the history
…eady exists files #98

custom error: when you installing the same folder and the folder already exists files
  • Loading branch information
sharafdin authored Feb 11, 2024
2 parents ba14086 + 611e67b commit 043ab42
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/yonode/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ if (!projectName) {
message: "What is your project name?",
default: 'yonode-app'
},
).then(name => { projectName = name.projectName, main() })
).then(name => {
if (name.projectName === '.') {
const files = fs.readdirSync(cloneDirectory);

if (files.length) {
console.log("The directory is not empty.");
process.exit(1);
}
} else { projectName = name.projectName, main() }
})
} else {
main()
}
Expand Down

0 comments on commit 043ab42

Please sign in to comment.