Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(node): prompt for app framework #14357

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions docs/generated/packages/node/generators/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`),
Expand Down
7 changes: 6 additions & 1 deletion packages/node/src/generators/application/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ export interface Schema {
rootProject?: boolean;
}

export type NodeJsFrameWorks = 'express' | 'koa' | 'fastify' | 'connect';
export type NodeJsFrameWorks =
| 'express'
| 'koa'
| 'fastify'
| 'connect'
| 'none';
23 changes: 16 additions & 7 deletions packages/node/src/generators/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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": []
Expand Down