feat(schematics): add interactive prompts

This commit is contained in:
--get 2018-10-18 16:56:28 -04:00 committed by Victor Savkin
parent 8c22ae41bb
commit 479bf5bee9
7 changed files with 116 additions and 49 deletions

View File

@ -4,17 +4,19 @@
"title": "Nx Application Options Schema", "title": "Nx Application Options Schema",
"type": "object", "type": "object",
"properties": { "properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"name": { "name": {
"description": "The name of the application.", "description": "The name of the application.",
"type": "string", "type": "string",
"$default": { "$default": {
"$source": "argv", "$source": "argv",
"index": 0 "index": 0
} },
"x-prompt": "What name would you like to use for the application?"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"x-prompt": "In which directory should the application be generated?"
}, },
"inlineStyle": { "inlineStyle": {
"description": "Specifies if the style will be in the ts file.", "description": "Specifies if the style will be in the ts file.",
@ -36,7 +38,8 @@
"routing": { "routing": {
"type": "boolean", "type": "boolean",
"description": "Generates a routing module.", "description": "Generates a routing module.",
"default": false "default": false,
"x-prompt": "Would you like to add Angular routing?"
}, },
"prefix": { "prefix": {
"type": "string", "type": "string",
@ -47,7 +50,18 @@
"style": { "style": {
"description": "The file extension to be used for style files.", "description": "The file extension to be used for style files.",
"type": "string", "type": "string",
"default": "css" "default": "css",
"x-prompt": {
"message": "Which stylesheet format would you like to use?",
"type": "list",
"items": [
{ "value": "css", "label": "CSS" },
{ "value": "scss", "label": "SCSS [ http://sass-lang.com ]" },
{ "value": "sass", "label": "SASS [ http://sass-lang.com ]" },
{ "value": "less", "label": "LESS [ http://lesscss.org ]" },
{ "value": "styl", "label": "Stylus [ http://stylus-lang.com ]" }
]
}
}, },
"skipTests": { "skipTests": {
"description": "Skip creating spec files.", "description": "Skip creating spec files.",
@ -65,15 +79,26 @@
"default": false, "default": false,
"description": "Do not add dependencies to package.json." "description": "Do not add dependencies to package.json."
}, },
"tags": {
"type": "string",
"description": "Add tags to the application (used for linting)"
},
"unitTestRunner": { "unitTestRunner": {
"type": "string", "type": "string",
"enum": ["karma", "jest", "none"], "enum": ["karma", "jest", "none"],
"description": "Test runner to use for unit tests", "description": "Test runner to use for unit tests",
"default": "karma" "default": "karma",
"x-prompt": {
"message":
"Which Unit Test Runner would you like to use for the application?",
"type": "list",
"items": [
{ "value": "karma", "label": "Karma" },
{ "value": "jest", "label": "Jest (https://jestjs.io/)" }
]
}
},
"tags": {
"type": "string",
"description": "Add tags to the application (used for linting)",
"x-prompt":
"Which tags would you like to add to the application? (used for linting)"
} }
}, },
"required": [] "required": []

View File

@ -10,11 +10,13 @@
"$default": { "$default": {
"$source": "argv", "$source": "argv",
"index": 0 "index": 0
} },
"x-prompt": "What name would you like to use for the library?"
}, },
"directory": { "directory": {
"type": "string", "type": "string",
"description": "A directory where the app is placed" "description": "A directory where the app is placed",
"x-prompt": "In which directory should the library be generated?"
}, },
"publishable": { "publishable": {
"type": "boolean", "type": "boolean",
@ -42,36 +44,52 @@
"default": false, "default": false,
"description": "Do not update tsconfig.json for development experience." "description": "Do not update tsconfig.json for development experience."
}, },
"parentModule": {
"type": "string",
"description":
"Update the router configuration of the parent module using loadChildren or children, depending on what `lazy` is set to.",
"x-prompt": "Which module should import the library?"
},
"routing": { "routing": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "Add router configuration. See lazy for more information." "description": "Add router configuration. See lazy for more information.",
"x-prompt":
"Would you like to add a routing configuration to the library?"
}, },
"lazy": { "lazy": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "description":
"Add RouterModule.forChild when set to true, and a simple array of routes when set to false." "Add RouterModule.forChild when set to true, and a simple array of routes when set to false.",
"x-prompt": "Will this library be lazy loaded?"
}, },
"module": { "module": {
"type": "boolean", "type": "boolean",
"default": true, "default": true,
"description": "Include an NgModule in the library." "description": "Include an NgModule in the library.",
}, "x-prompt": "Would you like to generate an NgModule within the library?"
"parentModule": {
"type": "string",
"description":
"Update the router configuration of the parent module using loadChildren or children, depending on what `lazy` is set to."
}, },
"tags": { "tags": {
"type": "string", "type": "string",
"description": "Add tags to the library (used for linting)" "description": "Add tags to the library (used for linting)",
"x-prompt":
"Which tags would you like to add to the library? (used for linting)"
}, },
"unitTestRunner": { "unitTestRunner": {
"type": "string", "type": "string",
"enum": ["karma", "jest", "none"], "enum": ["karma", "jest", "none"],
"description": "Test runner to use for unit tests", "description": "Test runner to use for unit tests",
"default": "karma" "default": "karma",
"x-prompt": {
"message":
"Which Unit Test Runner would you like to use for the library?",
"type": "list",
"items": [
{ "value": "karma", "label": "Karma" },
{ "value": "jest", "label": "Jest (https://jestjs.io/)" }
]
}
} }
}, },
"required": [] "required": []

View File

@ -7,7 +7,9 @@
"properties": { "properties": {
"npmScope": { "npmScope": {
"type": "string", "type": "string",
"description": "Npm scope for importing libs." "description": "Npm scope for importing libs.",
"x-prompt":
"What is the npm scope you would like to use for your Nx Workspace?"
}, },
"skipInstall": { "skipInstall": {
"type": "boolean", "type": "boolean",

View File

@ -4,12 +4,6 @@
"title": "Create an empty workspace", "title": "Create an empty workspace",
"type": "object", "type": "object",
"properties": { "properties": {
"directory": {
"type": "string",
"format": "path",
"description": "The directory name to create the workspace in.",
"default": ""
},
"name": { "name": {
"description": "The name of the workspace.", "description": "The name of the workspace.",
"type": "string", "type": "string",
@ -17,11 +11,20 @@
"$default": { "$default": {
"$source": "argv", "$source": "argv",
"index": 0 "index": 0
} },
"x-prompt": "What name would you like to use for the workspace?"
},
"directory": {
"type": "string",
"format": "path",
"description": "The directory name to create the workspace in.",
"default": ""
}, },
"npmScope": { "npmScope": {
"type": "string", "type": "string",
"description": "Npm scope for importing libs." "description": "Npm scope for importing libs.",
"x-prompt":
"What is the npm scope you would like to use for your Nx Workspace?"
}, },
"skipInstall": { "skipInstall": {
"description": "Skip installing dependency packages.", "description": "Skip installing dependency packages.",
@ -36,7 +39,16 @@
}, },
"packageManager": { "packageManager": {
"type": "string", "type": "string",
"description": "Package manager used in the project." "description": "Package manager used in the project.",
"x-prompt": {
"message":
"Which Package Manager would you like to use for your workspace?",
"type": "list",
"items": [
{ "value": "npm", "label": "" },
{ "value": "yarn", "label": "Yarn (https://yarnpkg.com/)" }
]
}
}, },
"commit": { "commit": {
"description": "Initial repository commit information.", "description": "Initial repository commit information.",

View File

@ -11,7 +11,15 @@
"$default": { "$default": {
"$source": "argv", "$source": "argv",
"index": 0 "index": 0
} },
"x-prompt": "What name would you like to use for the ngrx state?"
},
"module": {
"type": "string",
"description":
"Path to ngModule; host directory will contain the new '+state' directory (e.g., libs/comments/src/lib/comments-state.module.ts).",
"x-prompt":
"What is the path to the module where this ngrx state should be added to?"
}, },
"directory": { "directory": {
"type": "string", "type": "string",
@ -19,22 +27,19 @@
"description": "description":
"Override the name of the folder used to contain/group the NgRx files: contains actions, effects, reducers. selectors. (e.g., +state)" "Override the name of the folder used to contain/group the NgRx files: contains actions, effects, reducers. selectors. (e.g., +state)"
}, },
"module": {
"type": "string",
"description":
"Path to ngModule; host directory will contain the new '+state' directory (e.g., libs/comments/src/lib/comments-state.module.ts)."
},
"root": { "root": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "description":
"Add StoreModule.forRoot and EffectsModule.forRoot() instead of forFeature (e.g., --root)." "Add StoreModule.forRoot and EffectsModule.forRoot() instead of forFeature (e.g., --root).",
"x-prompt": "Is this the root state of the application?"
}, },
"facade": { "facade": {
"type": "boolean", "type": "boolean",
"default": false, "default": false,
"description": "description":
"Create a Facade class for the the Feature (e.g., --facade)." "Create a Facade class for the the Feature (e.g., --facade).",
"x-prompt": "Would you like to add a Facade to your ngrx state"
}, },
"onlyAddFiles": { "onlyAddFiles": {
"type": "boolean", "type": "boolean",

View File

@ -4,17 +4,19 @@
"title": "Nx Application Options Schema", "title": "Nx Application Options Schema",
"type": "object", "type": "object",
"properties": { "properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"name": { "name": {
"description": "The name of the application.", "description": "The name of the application.",
"type": "string", "type": "string",
"$default": { "$default": {
"$source": "argv", "$source": "argv",
"index": 0 "index": 0
} },
"x-prompt": "What name would you like to use for the node application?"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"x-prompt": "In which directory should the node application be generated?"
}, },
"framework": { "framework": {
"type": "string", "type": "string",
@ -40,7 +42,9 @@
}, },
"tags": { "tags": {
"type": "string", "type": "string",
"description": "Add tags to the application (used for linting)" "description": "Add tags to the application (used for linting)",
"x-prompt":
"Which tags would you like to add to the node application? (used for linting)"
} }
}, },
"required": [] "required": []

View File

@ -10,7 +10,8 @@
"$default": { "$default": {
"$source": "argv", "$source": "argv",
"index": 0 "index": 0
} },
"x-prompt": "What name would you like to use for the workspace schematic?"
}, },
"skipFormat": { "skipFormat": {
"description": "Skip formatting files", "description": "Skip formatting files",