Skip to content

Commit 2321c59

Browse files
committed
refactor: project prompts
1 parent 671d16e commit 2321c59

File tree

2 files changed

+19
-11
lines changed

2 files changed

+19
-11
lines changed

src/Helper/humanize/index.ts

+12-4
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.ts

+7-7
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)