Skip to content

Commit

Permalink
feat(node): prompt for app framework
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo authored and Jack Hsu committed Jan 13, 2023
1 parent 00caf6a commit f611b79
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 16 deletions.
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

0 comments on commit f611b79

Please sign in to comment.