What is @angular-devkit/schematics-cli?
@angular-devkit/schematics-cli is a command-line interface tool that allows developers to create and manage schematics in Angular projects. Schematics are templates for code generation and modification, which can be used to automate repetitive tasks, enforce coding standards, and streamline project setup.
What are @angular-devkit/schematics-cli's main functionalities?
Generate a new schematic
This command generates a new blank schematic with the specified name. Schematics can be used to automate code generation and modifications in Angular projects.
schematics blank --name=my-schematic
Run a schematic
This command runs a schematic from the current directory. The schematic will perform the code generation or modification tasks defined in its implementation.
schematics .:my-schematic
Debug a schematic
This command runs a schematic in debug mode, allowing developers to see detailed logs and diagnose issues with their schematics.
schematics .:my-schematic --debug=false
Other packages similar to @angular-devkit/schematics-cli
yeoman-generator
Yeoman Generator is a scaffolding tool that allows developers to create custom generators for project setup and code generation. It is more general-purpose compared to @angular-devkit/schematics-cli, which is specifically designed for Angular projects.
plop
Plop is a micro-generator framework that allows developers to create custom generators for code scaffolding. It is lightweight and flexible, making it suitable for a wide range of projects, not just Angular.
hygen
Hygen is a fast and lightweight code generator that allows developers to create and run custom templates. It focuses on simplicity and speed, making it a good alternative for those who need quick and easy code generation without the complexity of Angular-specific tools.
Schematics CLI
This package contains the executable for running a Schematic.
Usage
$ schematics [CollectionName:]SchematicName [options, ...]
By default, if the collection name is not specified, use the internal collection provided
by the Schematics CLI.
Options:
--debug Debug mode. This is true by default if the collection is a relative
path (in that case, turn off with --debug=false).
--allow-private Allow private schematics to be run from the command line. Default to
false.
--dry-run Do not output anything, but instead just show what actions would be
performed. Default to true if debug is also true.
--force Force overwriting files that would otherwise be an error.
--list-schematics List all schematics from the collection, by name. A collection name
should be suffixed by a colon. Example: '@angular-devkit/schematics-cli:'.
--no-interactive Disables interactive input prompts.
--verbose Show more information.
--help Show this message.
Any additional option is passed to the Schematics depending on its schema.
Examples
- Create a new NPM package that contains a blank schematic.
$ schematics blank <name>
- Walkthrough example that demonstrates how to build a schematic.
$ schematics schematic --name <name>
17.3.4 (2024-04-11)
@angular-devkit/build-angular
| Commit | Type | Description |
| --------------------------------------------------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| 1128bdd64 | fix | ensure esbuild-based builders exclusively produce ESM output |
<!-- CHANGELOG SPLIT MARKER -->
<a name="16.2.14"></a>