easy-angular-generators v0.0.2
easy-angular-generator
Easy angular generator is a command line tool to generate some every day used AngularJS controllers, directives, filters, services/factories. All of them based on @jhonpapa's angular style guide
Why?
As a full-time AngularJS developer I create everyday one or more controller, directive, filter, service/factory, etc, so I decided to create this tool to optimize my work flow.
How to install?
npm install -g easy-angular-generators
Usage
Just run ag --help
and you will see a list of available commands. Each commands has its own help section.
Usage: ag [options] [command]
Commands:
controller|c [options] <name> Generates an AngularJS Controlller with optional specs.
directive|d [options] <name> Generates an AngularJS Directive with link function by default with optional specs.
service|s [options] <name> Generates an AngularJS Service (Factory) with optional specs.
factory|f [options] <name> Generates an AngularJS Factory with optional specs.
filter|l [options] <name> Generates an AngularJS Filter with optional specs.
Options:
-h, --help output usage information
Conventions? NO
I didn't want to follow any convention for the folder/path to save the generated files since each developer has it's own preferences.
Here some examples:
ag controller AuthController
ag filter onlyNumbersGTFive
ag controller UsersController -f app/js/controllers -m MyApp -d '$timeout, MyService, MyFactory' -t app/specs/controllers
ag directive fullName -f app/js/directives -m MyApp -t app/specs/directives
ag directive fullName -f app/js/directives -m MyApp -t app/specs/directives -c fullNameDirectiveController
ag service Connect -f app/js/services -m MyApp -d '$scope' -t app/specs/services
ag factory People -f app/js/factories -m MyApp -d 'MyService, MyFactory' -t app/specs/factories
This same rule applies for everything else.
Remember to scape the special character \$ used on dependencies like $scope, $timeout, etc.
Wanna contribute?
Sure, bellow, you will find a list of what's next.
- fork repository.
- create feature/fix branch
- commit and push to your own forked repository. (Do not forget to add yourself as a collaborator)
- send pull request.
TODO
- Optimize.
- Write tests.
- Commands for AngularJS 2 based on same guide.
- include an starter command to create a brand new app with AngularJS.