From ad063308d8be8ce90ac2084b83d7d73b5db38c6d Mon Sep 17 00:00:00 2001 From: FrozenPandaz Date: Mon, 23 Jan 2023 16:09:29 -0500 Subject: [PATCH] fix(misc): refine the prompts in create-nx-workspace --- .../bin/create-nx-workspace.ts | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/packages/create-nx-workspace/bin/create-nx-workspace.ts b/packages/create-nx-workspace/bin/create-nx-workspace.ts index 964d81b8f1467c..e38bf135674eb5 100644 --- a/packages/create-nx-workspace/bin/create-nx-workspace.ts +++ b/packages/create-nx-workspace/bin/create-nx-workspace.ts @@ -483,7 +483,7 @@ function determineMonorepoStyle(): Promise { { name: 'react', message: - 'Standalone React app: Nx configures Vite, Vitest, ESLint, and Cypress.', + 'Standalone React app: Nx configures Vite (or Webpack), ESLint, and Cypress.', }, { name: 'angular', @@ -493,7 +493,7 @@ function determineMonorepoStyle(): Promise { { name: 'node-server', message: - 'Standalone Node Server app: Nx configures your framework of choice (e.g. Express) along with esbuild, Eslint and Jest.', + 'Standalone Node Server app: Nx configures a framework (ex. Express), esbuild, ESlint and Jest.', }, ], }, @@ -687,14 +687,27 @@ async function determineFramework( return Promise.resolve(''); } - const frameworkChoices = ['express', 'koa', 'fastify', 'connect']; + const frameworkChoices = [ + { + name: 'express', + message: 'Express [https://expressjs.com/]', + }, + { + name: 'koa', + message: 'koa [https://koajs.com/]', + }, + { + name: 'fastify', + message: 'fastify [https://www.fastify.io/]', + }, + ]; if (!parsedArgs.framework) { return enquirer .prompt([ { message: 'What framework should be used?', - type: 'select', + type: 'autocomplete', name: 'framework', choices: frameworkChoices, }, @@ -702,15 +715,17 @@ async function determineFramework( .then((a: { framework: string }) => a.framework); } - const foundFramework = frameworkChoices.indexOf(parsedArgs.framework); + const foundFramework = frameworkChoices + .map(({ name }) => name) + .indexOf(parsedArgs.framework); if (foundFramework < 0) { output.error({ - title: 'Invalid framwork', + title: 'Invalid framework', bodyLines: [ `It must be one of the following:`, '', - ...frameworkChoices.map((choice) => choice), + ...frameworkChoices.map(({ name }) => name), ], }); @@ -852,11 +867,11 @@ async function determineBundler( const choices = [ { name: 'vite', - message: 'Vite [ https://vitejs.dev/ ]', + message: 'Vite [ https://vitejs.dev/ ]', }, { name: 'webpack', - message: 'Webpack [ https://webpack.js.org/ ]', + message: 'Webpack [ https://webpack.js.org/ ]', }, ];