Skip to content

Commit

Permalink
Merge pull request #1367 from monstar-lab-oss/fix/project-folder-name
Browse files Browse the repository at this point in the history
fix: remove JSON.stringify
  • Loading branch information
jinmayamashita authored Aug 23, 2024
2 parents 232a645 + dff61e6 commit 0627110
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/wet-snails-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"start-frontend": patch
---

fix: remove JSON.stringify by @ptrkdan @jinmayamashita
45 changes: 30 additions & 15 deletions packages/start-frontend/src/helpers/prompt-clack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,38 @@ const t = gradient("#53575a", "#ffff00");

export async function propmtClackDir() {
intro(`${g("ꮙ START-")}${t("FRONTEND")}`);
const result = await text({
message: color.blue("Where Would You like to Create Your Application?"),
placeholder: "./my-app",
initialValue: "./my-app",
validate: (value) => {
if (!value) {
return "Please provide a location path";
}
// regular expression that text start from ./
const Reg = new RegExp("^\\./");
if (!Reg.test(value)) {
return "Please input a valid location path";
}
const { dir } = await group(
{
dir: () =>
text({
message: color.blue(
"Where Would You like to Create Your Application?"
),
placeholder: "./my-app",
initialValue: "./my-app",
validate: (value) => {
if (!value) {
return "Please provide a location path";
}
// regular expression that text start from ./
const Reg = new RegExp("^\\./");
if (!Reg.test(value)) {
return "Please input a valid location path";
}
},
}),
},
});
{
// On Cancel callback that wraps the group
// So if the user cancels one of the prompts in the group this function will be called
onCancel: () => {
cancel("Operation cancelled.");
process.exit(0);
},
}
);

return JSON.stringify(result);
return dir;
}

export async function promptClack() {
Expand Down

0 comments on commit 0627110

Please sign in to comment.