/ng-new-extended-angular-schematic

A schematic that extends ng-new and builds baseline file structure

Primary LanguageTypeScript

Prerequisites IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!! THIS WILL NOT WORK WITHOUT THESE 2 GLOBAL PACKAGES

The @schematics/angular package needs to be installed for this to work (install globally) run npm i -g @schematics/angular We also need the schematics cli run npm i -g @angular-devkit/schematics-cli

To create a new SDI Angular project

This schematic must be run within the context of the @angular-devkit/schematics-cli environment, rather than the normal @angular/cli environment (hence having to install the above 2 global dependencies) Once you have cloned this repo on your local machine, navigate into any directory you would like on your development machine, and run the following command: schematics /Path/to/cloned/repo/src/collection.json:ng-new-gci --debug=false

The schematics cli will then prompt you for inputs such as project name, dependencies, etc Voila! You have now just created a new base GCI Angular project with all of our default configs, files, scss, etc

Note - you can create an alias in your ~/.bash_profile or ~/.bashrc and save this entire command, then just run your alias command. Make sure the alias is pointing to the correct path for the cloned schematics repo i.e. on my local machine, to .bashrc i added alias ng-new-gci="schematics ~/Projects/schematics/sdi-angular-schematic/src/collection.json:ng-new-gci --debug=false" source ~/.bashrc Now from any directory on my dev filesystem, i can run the command 'ng-new-gci'

Getting Started With Schematics

This repository is a basic Schematic implementation that serves as a starting point to create schematics.

Testing

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

Unit Testing

npm run test will run the unit tests, using Jasmine as a runner and test framework.