ng_generate
Create Angular artifacts like components or services using a specified schematic. Define the artifact name, path, and app root for precise file generation, with optional settings for interactive prompts and dry runs.
Instructions
Run 'ng generate' to create a new Angular artifact (component, service, etc.)
Input Schema
Name | Required | Description | Default |
---|---|---|---|
appRoot | Yes | The absolute path to the first folder in the 'path' property. For example, if 'path' is 'webui/src/app/modules/alerts', then 'appRoot' should be the absolute path to 'webui'. | |
name | Yes | The name of the artifact to generate | |
options | No | Additional options for the schematic | |
path | No | The path where the artifact should be created, relative to the appRoot (do not include the app folder itself). For example, if the full path is 'webui/src/app/modules/alerts' and appRoot is 'webui', then path should be 'src/app/modules/alerts'. | src/app |
schematic | Yes | The schematic to generate (e.g., component, service) |
Input Schema (JSON Schema)
{
"properties": {
"appRoot": {
"description": "The absolute path to the first folder in the 'path' property. For example, if 'path' is 'webui/src/app/modules/alerts', then 'appRoot' should be the absolute path to 'webui'.",
"type": "string"
},
"name": {
"description": "The name of the artifact to generate",
"type": "string"
},
"options": {
"additionalProperties": {
"type": "string"
},
"description": "Additional options for the schematic",
"properties": {
"defaults": {
"default": false,
"description": "Disable interactive input prompts for options with a default.",
"type": "boolean"
},
"dryRun": {
"default": false,
"description": "Run through and report activity without writing out results.",
"type": "boolean"
},
"force": {
"default": false,
"description": "Force overwriting of existing files.",
"type": "boolean"
},
"help": {
"default": false,
"description": "Shows a help message for this command in the console.",
"type": "boolean"
},
"interactive": {
"default": true,
"description": "Enable interactive input prompts.",
"type": "boolean"
}
},
"type": "object"
},
"path": {
"default": "src/app",
"description": "The path where the artifact should be created, relative to the appRoot (do not include the app folder itself). For example, if the full path is 'webui/src/app/modules/alerts' and appRoot is 'webui', then path should be 'src/app/modules/alerts'.",
"type": "string"
},
"schematic": {
"description": "The schematic to generate (e.g., component, service)",
"type": "string"
}
},
"required": [
"schematic",
"name",
"appRoot"
],
"type": "object"
}