This repository is a basic Schematic implementation to generate Angular Forms using a JSON description
To test this schematic you must follow the steps:
cd form-generator
npm install
npm run build
cd example/angular-template
npm install
npm link ../../
npm start
Now you can proccede creating forms component and testing the generator.
PS: Inside angular-template/jsons folder has some form schemas example to be used.
This schematic is responsible for generate a form schematic using a pass by JSON, using bootstrap!
ng g form path/name-component ./jsons/schema.json
or
ng g f path/name-component ./jsons/schema.json
Options Available:
Option | Type | Description | Enums | Default |
---|---|---|---|---|
--name, first argv | string | Custom component name. What name would you like to use for the forms? | ||
--config, -c, second argv | string | Config file to the forms. What the name of the config file? | ||
--style | string | The file extension to be used for style files. | scss | |
--viewEncapsulation, -v | string | Specifies the view encapsulation strategy. | "Emulated", "None" | |
--prefix, -p | string | The prefix to apply to generated selectors. | app | |
--changeDetection, -cd | string | Specifies the change detection strategy. | "Default", "OnPush" | Default |
--export, -e | boolean | Specifies if declaring module exports the component. | false | |
--entryComponent | boolean | Specifies if the component is an entry component of declaring module. | false |
cd form-generator
npm install
npm run build
npm link ../path-forms/forms-generator
Inside your angular json in "cli" key you should add:
"defaultCollection": "forms"
will stay:
"cli": {
"analytics": false,
"defaultCollection": "forms"
}
ReactiveFormsModule,
FormsModule,
NgxMaskModule.forRoot({
validation: true
})
To test locally, install @angular-devkit/schematics-cli
globally and use the schematics
command line tool. That tool acts the same as the generate
command of the Angular CLI, but also has a debug mode.
Check the documentation with
schematics --help
npm run test
will run the unit tests, using Jasmine as a runner and test framework.
To publish, simply do:
npm run build
npm publish
That's it!
Pickup an item on backlog, create an issue and submit the PR.
MIT licence, check LICENSE.md