fix: exists check, projectName validation on pre-enter
This commit is contained in:
Vendored
+6
-1
@@ -29,7 +29,8 @@ async function main() {
|
||||
return "Project name is required";
|
||||
if (!/^[a-zA-Z0-9-]+$/.test(value))
|
||||
return "Project name can only contain letters, numbers, and dashes";
|
||||
if (fs.existsSync(value))
|
||||
const targetDir = path.resolve(process.cwd(), value);
|
||||
if (fs.existsSync(targetDir))
|
||||
return "Directory already exists";
|
||||
return true;
|
||||
},
|
||||
@@ -39,6 +40,10 @@ async function main() {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
if (!/^[a-zA-Z0-9-]+$/.test(projectName)) {
|
||||
console.error("❌ Project name can only contain letters, numbers, and dashes");
|
||||
process.exit(1);
|
||||
}
|
||||
const templateType = await select({
|
||||
message: "Please select a template type:",
|
||||
choices: projectTypes,
|
||||
|
||||
Reference in New Issue
Block a user