From 2321c59af26b0397c646716f38447c752876bf88 Mon Sep 17 00:00:00 2001 From: Batuhan Wilhelm Date: Wed, 27 Sep 2023 17:23:13 +0300 Subject: [PATCH 1/3] refactor: project prompts --- src/Helper/humanize/index.ts | 16 ++++++++++++---- src/Helper/source/index.ts | 14 +++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/Helper/humanize/index.ts b/src/Helper/humanize/index.ts index 6a07749b..855c1015 100644 --- a/src/Helper/humanize/index.ts +++ b/src/Helper/humanize/index.ts @@ -1,6 +1,7 @@ export const HumanizeChoices = { get: ( choice: string, + projectType?: string, ): { title: string; description: string; value: string } => { switch (choice) { case "react": @@ -17,28 +18,35 @@ export const HumanizeChoices = { }; case "refine-vite": return { - title: "refine(Vite)", + title: projectType === "refine" ? "Vite" : "refine (Vite)", description: "Creates a refine React Vite project (Recommended for CRUD applications).", value: choice, }; case "refine-nextjs": return { - title: "refine(Next.js)", + title: + projectType === "refine" + ? "Next.js" + : "refine (Next.js)", description: "Creates a refine Next.js project with SSR support (Recommended for CRUD applications).", value: choice, }; case "refine-remix": return { - title: "refine(Remix)", + title: + projectType === "refine" ? "Remix" : "refine (Remix)", description: "Creates a refine Remix project with SSR support (Recommended for CRUD applications)", value: choice, }; case "refine-react": return { - title: "refine(CRA) [Legacy]", + title: + projectType === "refine" + ? "CRA [Legacy]" + : "refine (CRA) [Legacy]", description: "Creates a basic refine project (Recommended for CRUD applications)", value: choice, diff --git a/src/Helper/source/index.ts b/src/Helper/source/index.ts index 5ff12004..03af9652 100644 --- a/src/Helper/source/index.ts +++ b/src/Helper/source/index.ts @@ -108,12 +108,12 @@ export const sort_project_types = ( projectTypes: { title: string; value: string }[], ): { title: string; value: string }[] => { const order: Record = { - react: 1, - nextjs: 2, - "refine-vite": 3, - "refine-nextjs": 4, - "refine-remix": 5, - "refine-react": 6, + "refine-vite": 1, + "refine-nextjs": 2, + "refine-remix": 3, + "refine-react": 4, + react: 5, + nextjs: 6, }; const newProjectTypes = [...projectTypes]; @@ -174,7 +174,7 @@ export const prompt_project_types = async ( ? filteredWithContains : types ) - .map((p) => HumanizeChoices.get(p.title)) + .map((p) => HumanizeChoices.get(p.title, typeFromArgs)) .map((p) => ({ type: "select", name: p.value, From e293199eb7763e84fd4b8fe64bfe6b90370927eb Mon Sep 17 00:00:00 2001 From: Batuhan Wilhelm Date: Wed, 27 Sep 2023 18:13:33 +0300 Subject: [PATCH 2/3] fix: specs --- src/Helper/source/index.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Helper/source/index.spec.ts b/src/Helper/source/index.spec.ts index ed573fc8..c288703a 100644 --- a/src/Helper/source/index.spec.ts +++ b/src/Helper/source/index.spec.ts @@ -39,12 +39,12 @@ describe("Source Helper", () => { { title: "Refine Remix", value: "refine-remix" }, ], expectedOutput: [ - { title: "React", value: "react" }, - { title: "Next.js", value: "nextjs" }, { title: "Refine Vite", value: "refine-vite" }, { title: "Refine Next.js", value: "refine-nextjs" }, { title: "Refine Remix", value: "refine-remix" }, { title: "Refine React", value: "refine-react" }, + { title: "React", value: "react" }, + { title: "Next.js", value: "nextjs" }, ], }, { @@ -57,12 +57,12 @@ describe("Source Helper", () => { { title: "Refine Vite", value: "refine-vite" }, ], expectedOutput: [ - { title: "React", value: "react" }, - { title: "Next.js", value: "nextjs" }, { title: "Refine Vite", value: "refine-vite" }, { title: "Refine Next.js", value: "refine-nextjs" }, { title: "Refine Remix", value: "refine-remix" }, { title: "Refine React", value: "refine-react" }, + { title: "React", value: "react" }, + { title: "Next.js", value: "nextjs" }, ], }, { From dc085d9e350b4194e0a4989d167d294c8530bded Mon Sep 17 00:00:00 2001 From: Batuhan Wilhelm Date: Wed, 27 Sep 2023 18:18:03 +0300 Subject: [PATCH 3/3] 1.17.6 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f90ac05..c30efc90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "superplate-cli", - "version": "1.17.5", + "version": "1.17.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "superplate-cli", - "version": "1.17.5", + "version": "1.17.6", "license": "MIT", "dependencies": { "chalk": "^4.1.0", diff --git a/package.json b/package.json index e611e910..9c94c145 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "superplate-cli", - "version": "1.17.5", + "version": "1.17.6", "description": "The frontend boilerplate with superpowers", "license": "MIT", "repository": {