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",
"type": "object",
"properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"name": {
"description": "The name of the application.",
"type": "string",
"$default": {
"$source": "argv",
"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": {
"description": "Specifies if the style will be in the ts file.",
@ -36,7 +38,8 @@
"routing": {
"type": "boolean",
"description": "Generates a routing module.",
"default": false
"default": false,
"x-prompt": "Would you like to add Angular routing?"
},
"prefix": {
"type": "string",
@ -47,7 +50,18 @@
"style": {
"description": "The file extension to be used for style files.",
"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": {
"description": "Skip creating spec files.",
@ -65,15 +79,26 @@
"default": false,
"description": "Do not add dependencies to package.json."
},
"tags": {
"type": "string",
"description": "Add tags to the application (used for linting)"
},
"unitTestRunner": {
"type": "string",
"enum": ["karma", "jest", "none"],
"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": []

View File

@ -10,11 +10,13 @@
"$default": {
"$source": "argv",
"index": 0
}
},
"x-prompt": "What name would you like to use for the library?"
},
"directory": {
"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": {
"type": "boolean",
@ -42,36 +44,52 @@
"default": false,
"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": {
"type": "boolean",
"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": {
"type": "boolean",
"default": false,
"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": {
"type": "boolean",
"default": true,
"description": "Include an NgModule in 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."
"description": "Include an NgModule in the library.",
"x-prompt": "Would you like to generate an NgModule within the library?"
},
"tags": {
"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": {
"type": "string",
"enum": ["karma", "jest", "none"],
"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": []

View File

@ -7,7 +7,9 @@
"properties": {
"npmScope": {
"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": {
"type": "boolean",

View File

@ -4,12 +4,6 @@
"title": "Create an empty workspace",
"type": "object",
"properties": {
"directory": {
"type": "string",
"format": "path",
"description": "The directory name to create the workspace in.",
"default": ""
},
"name": {
"description": "The name of the workspace.",
"type": "string",
@ -17,11 +11,20 @@
"$default": {
"$source": "argv",
"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": {
"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": {
"description": "Skip installing dependency packages.",
@ -36,7 +39,16 @@
},
"packageManager": {
"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": {
"description": "Initial repository commit information.",

View File

@ -11,7 +11,15 @@
"$default": {
"$source": "argv",
"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": {
"type": "string",
@ -19,22 +27,19 @@
"description":
"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": {
"type": "boolean",
"default": false,
"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": {
"type": "boolean",
"default": false,
"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": {
"type": "boolean",

View File

@ -4,17 +4,19 @@
"title": "Nx Application Options Schema",
"type": "object",
"properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"name": {
"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?"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"x-prompt": "In which directory should the node application be generated?"
},
"framework": {
"type": "string",
@ -40,7 +42,9 @@
},
"tags": {
"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": []

View File

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