Skip to content

Commit 033d8ed

Browse files
committed
fix: check whether output folder already exists or not
1 parent 98bc941 commit 033d8ed

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ const { outputFolder } = await inquirer.prompt<{
5757
type: "input",
5858
message: "Enter the output folder:",
5959
name: "outputFolder",
60+
validate: (value) => {
61+
if (fs.existsSync(path.resolve(process.cwd(), value)))
62+
return "This folder already exists";
63+
return true;
64+
},
6065
});
6166

6267
fs.mkdirSync(path.resolve(process.cwd(), outputFolder), { recursive: true });

0 commit comments

Comments
 (0)