From bbc16d6b115fb389ee0fe58d909e74a162686163 Mon Sep 17 00:00:00 2001 From: Sebastian Rindom Date: Tue, 11 Jan 2022 14:06:16 +0100 Subject: [PATCH] feat(create-medusa-app): add medusa.express (#981) * feat(create-medusa-app): add medusa.express * fix: pr comments --- packages/create-medusa-app/src/index.ts | 32 +++++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/create-medusa-app/src/index.ts b/packages/create-medusa-app/src/index.ts index 3a325c4ad4..2e05bc3b79 100644 --- a/packages/create-medusa-app/src/index.ts +++ b/packages/create-medusa-app/src/index.ts @@ -32,7 +32,14 @@ const questions = { type: "select", name: "storefront", message: "Which storefront starter would you like to install?", - choices: ["Gatsby Starter", "Next.js Starter", "None"], + choices: [ + "Gatsby Starter", + "Next.js Starter", + "medusa.express (Next.js)", + "medusa.express (Gatsby)", + "Gatsby Starter (Simple)", + "None", + ], }, } @@ -51,6 +58,24 @@ const program = new Commander.Command(pkg.name) .option(`-v --verbose`, `Show all installation output`) .parse(process.argv) +const getStorefrontStarter = (starter: string): string => { + const selected = starter.toLowerCase() + switch (selected) { + case "gatsby starter": + return "https://github.com/medusajs/gatsby-starter-medusa" + case "next.js starter": + return "https://github.com/medusajs/nextjs-starter-medusa" + case "medusa.express (next.js)": + return "https://github.com/medusajs/medusa-express-nextjs" + case "medusa.express (gatsby)": + return "https://github.com/medusajs/medusa-express-gatsby" + case "gatsby starter (simple)": + return "https://github.com/medusajs/gatsby-starter-medusa-simple" + default: + return "" + } +} + export const run = async (): Promise => { track("CREATE_CLI") @@ -94,10 +119,7 @@ export const run = async (): Promise => { const hasStorefront = storefront.toLowerCase() !== "none" if (hasStorefront) { - const storefrontStarter = - storefront.toLowerCase() === "gatsby starter" - ? "https://github.com/medusajs/gatsby-starter-medusa" - : "https://github.com/medusajs/nextjs-starter-medusa" + const storefrontStarter = getStorefrontStarter(storefront) await newStarter({ starter: storefrontStarter, root: path.join(projectRoot, `storefront`),