Since I can not comment to what Petros said, I would like to mention that what he said is not enough. If you try to run the ng generate
command using my-component schema
it will complain that there is no argument named name
.
For the schematic to work with a name argument you need to create schema.json
file in my-component
folder with the name parameter
:
{
"properties": {
"name": {
"type": "string",
"minLength": 1
}
}
}
and then you need to update the collection.json
file to include a reference to that schema
file:
{
"$schema": "../node_modules/@angular-devkit/schematics/collection-schema.json",
"schematics": {
"my-component": {
"description": "Create a component and its corresponding Storybook file",
"factory": "./my-component/index#myComponent",
"schema": "./my-component/schema.json"
}
}
}
and then you can run the command:
ng generate my-component-storybook:my-component --name=my-component-name