From 3f6df0d54feed83064b1db941713e6df53208d7e Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Fri, 13 Jan 2023 14:14:02 -0500 Subject: [PATCH] feat(node): prompt for app framework (#14357) --- .../packages/node/generators/application.json | 23 +++++++++++++------ .../src/generators/application/application.ts | 2 +- .../src/generators/application/schema.d.ts | 7 +++++- .../src/generators/application/schema.json | 23 +++++++++++++------ 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/docs/generated/packages/node/generators/application.json b/docs/generated/packages/node/generators/application.json index b50e1dd1408b8..475858fdab230 100644 --- a/docs/generated/packages/node/generators/application.json +++ b/docs/generated/packages/node/generators/application.json @@ -13,21 +13,25 @@ "description": "The name of the application.", "type": "string", "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?" + "x-prompt": "What name would you like to use for the node application?", + "x-priority": "important" }, "directory": { "description": "The directory of the new application.", - "type": "string" + "type": "string", + "x-priority": "important" }, "skipFormat": { "description": "Skip formatting files", "type": "boolean", - "default": false + "default": false, + "x-priority": "internal" }, "skipPackageJson": { "type": "boolean", "default": false, - "description": "Do not add dependencies to `package.json`." + "description": "Do not add dependencies to `package.json`.", + "x-priority": "internal" }, "linter": { "description": "The tool to use for running lint checks.", @@ -83,18 +87,23 @@ "framework": { "description": "Generate the node application using a framework", "type": "string", - "enum": ["express", "koa", "fastify", "connect"] + "enum": ["express", "koa", "fastify", "connect", "none"], + "default": "none", + "x-prompt": "Which framework do you want to use?", + "x-priority": "important" }, "port": { "description": "The port which the server will be run on", "type": "number", - "default": 3000 + "default": 3000, + "x-priority": "important" }, "rootProject": { "description": "Create node application at the root of the workspace", "type": "boolean", "default": false, - "hidden": true + "hidden": true, + "x-priority": "internal" } }, "required": [], diff --git a/packages/node/src/generators/application/application.ts b/packages/node/src/generators/application/application.ts index 23c641a2b64c0..10d7872a23c01 100644 --- a/packages/node/src/generators/application/application.ts +++ b/packages/node/src/generators/application/application.ts @@ -161,7 +161,7 @@ function addAppFiles(tree: Tree, options: NormalizedSchema) { tree.delete(joinPathFragments(options.appProjectRoot, 'webpack.config.js')); } - if (options.framework) { + if (options.framework && options.framework !== 'none') { generateFiles( tree, join(__dirname, `./files/${options.framework}`), diff --git a/packages/node/src/generators/application/schema.d.ts b/packages/node/src/generators/application/schema.d.ts index 497abd5db2915..bebf50f8ff83d 100644 --- a/packages/node/src/generators/application/schema.d.ts +++ b/packages/node/src/generators/application/schema.d.ts @@ -20,4 +20,9 @@ export interface Schema { rootProject?: boolean; } -export type NodeJsFrameWorks = 'express' | 'koa' | 'fastify' | 'connect'; +export type NodeJsFrameWorks = + | 'express' + | 'koa' + | 'fastify' + | 'connect' + | 'none'; diff --git a/packages/node/src/generators/application/schema.json b/packages/node/src/generators/application/schema.json index ee86c6830ef46..77ddc8d2ac22c 100644 --- a/packages/node/src/generators/application/schema.json +++ b/packages/node/src/generators/application/schema.json @@ -13,21 +13,25 @@ "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the node application?" + "x-prompt": "What name would you like to use for the node application?", + "x-priority": "important" }, "directory": { "description": "The directory of the new application.", - "type": "string" + "type": "string", + "x-priority": "important" }, "skipFormat": { "description": "Skip formatting files", "type": "boolean", - "default": false + "default": false, + "x-priority": "internal" }, "skipPackageJson": { "type": "boolean", "default": false, - "description": "Do not add dependencies to `package.json`." + "description": "Do not add dependencies to `package.json`.", + "x-priority": "internal" }, "linter": { "description": "The tool to use for running lint checks.", @@ -83,18 +87,23 @@ "framework": { "description": "Generate the node application using a framework", "type": "string", - "enum": ["express", "koa", "fastify", "connect"] + "enum": ["express", "koa", "fastify", "connect", "none"], + "default": "none", + "x-prompt": "Which framework do you want to use?", + "x-priority": "important" }, "port": { "description": "The port which the server will be run on", "type": "number", - "default": 3000 + "default": 3000, + "x-priority": "important" }, "rootProject": { "description": "Create node application at the root of the workspace", "type": "boolean", "default": false, - "hidden": true + "hidden": true, + "x-priority": "internal" } }, "required": []