Skip to content

Commit 996db08

Browse files
authored
refactor: project prompts (#365)
* refactor: project prompts * fix: specs * 1.17.6
1 parent 671d16e commit 996db08

File tree

5 files changed

+26
-18
lines changed

5 files changed

+26
-18
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "superplate-cli",
3-
"version": "1.17.5",
3+
"version": "1.17.6",
44
"description": "The frontend boilerplate with superpowers",
55
"license": "MIT",
66
"repository": {

src/Helper/humanize/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const HumanizeChoices = {
22
get: (
33
choice: string,
4+
projectType?: string,
45
): { title: string; description: string; value: string } => {
56
switch (choice) {
67
case "react":
@@ -17,28 +18,35 @@ export const HumanizeChoices = {
1718
};
1819
case "refine-vite":
1920
return {
20-
title: "refine(Vite)",
21+
title: projectType === "refine" ? "Vite" : "refine (Vite)",
2122
description:
2223
"Creates a refine React Vite project (Recommended for CRUD applications).",
2324
value: choice,
2425
};
2526
case "refine-nextjs":
2627
return {
27-
title: "refine(Next.js)",
28+
title:
29+
projectType === "refine"
30+
? "Next.js"
31+
: "refine (Next.js)",
2832
description:
2933
"Creates a refine Next.js project with SSR support (Recommended for CRUD applications).",
3034
value: choice,
3135
};
3236
case "refine-remix":
3337
return {
34-
title: "refine(Remix)",
38+
title:
39+
projectType === "refine" ? "Remix" : "refine (Remix)",
3540
description:
3641
"Creates a refine Remix project with SSR support (Recommended for CRUD applications)",
3742
value: choice,
3843
};
3944
case "refine-react":
4045
return {
41-
title: "refine(CRA) [Legacy]",
46+
title:
47+
projectType === "refine"
48+
? "CRA [Legacy]"
49+
: "refine (CRA) [Legacy]",
4250
description:
4351
"Creates a basic refine project (Recommended for CRUD applications)",
4452
value: choice,

src/Helper/source/index.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ describe("Source Helper", () => {
3939
{ title: "Refine Remix", value: "refine-remix" },
4040
],
4141
expectedOutput: [
42-
{ title: "React", value: "react" },
43-
{ title: "Next.js", value: "nextjs" },
4442
{ title: "Refine Vite", value: "refine-vite" },
4543
{ title: "Refine Next.js", value: "refine-nextjs" },
4644
{ title: "Refine Remix", value: "refine-remix" },
4745
{ title: "Refine React", value: "refine-react" },
46+
{ title: "React", value: "react" },
47+
{ title: "Next.js", value: "nextjs" },
4848
],
4949
},
5050
{
@@ -57,12 +57,12 @@ describe("Source Helper", () => {
5757
{ title: "Refine Vite", value: "refine-vite" },
5858
],
5959
expectedOutput: [
60-
{ title: "React", value: "react" },
61-
{ title: "Next.js", value: "nextjs" },
6260
{ title: "Refine Vite", value: "refine-vite" },
6361
{ title: "Refine Next.js", value: "refine-nextjs" },
6462
{ title: "Refine Remix", value: "refine-remix" },
6563
{ title: "Refine React", value: "refine-react" },
64+
{ title: "React", value: "react" },
65+
{ title: "Next.js", value: "nextjs" },
6666
],
6767
},
6868
{

src/Helper/source/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ export const sort_project_types = (
108108
projectTypes: { title: string; value: string }[],
109109
): { title: string; value: string }[] => {
110110
const order: Record<string, number> = {
111-
react: 1,
112-
nextjs: 2,
113-
"refine-vite": 3,
114-
"refine-nextjs": 4,
115-
"refine-remix": 5,
116-
"refine-react": 6,
111+
"refine-vite": 1,
112+
"refine-nextjs": 2,
113+
"refine-remix": 3,
114+
"refine-react": 4,
115+
react: 5,
116+
nextjs: 6,
117117
};
118118

119119
const newProjectTypes = [...projectTypes];
@@ -174,7 +174,7 @@ export const prompt_project_types = async (
174174
? filteredWithContains
175175
: types
176176
)
177-
.map((p) => HumanizeChoices.get(p.title))
177+
.map((p) => HumanizeChoices.get(p.title, typeFromArgs))
178178
.map((p) => ({
179179
type: "select",
180180
name: p.value,

0 commit comments

Comments
 (0)