generator-angular-nmi

Yeoman generator for various AngularJS resources to encourage a common style within a project.


Keywords
yeoman-generator, angular, angularjs, yeoman, generator, styleguide, ng
License
GPL-3.0
Install
npm install generator-angular-nmi@2.1.4

Documentation

Build Status Dependency Status Coverage Status

What this is (and isn't) about

  • It does generate various AngularJS resources (controllers, factories, routes, etc.) in a standard way, so that different developers of your project follow the same style.
  • It does not generate an AngularJS app scaffolding/structure for you. For this, you may use the excellent generator-gulp-angular.
  • It does follow a very opinionated style, mainly based on John Papa's excellent AngularJS styleguide. If you want different templates to apply your own team's styling, fork and replace the templates under templates folder.
  • It does not perform any kind of validation of your structure, conformance check to guidelines, linting, compression, merging, optimising, or anything of that sort.
  • Inspired by generator-ng-super.

Install

Install Yeoman:

npm install -g yo

Install generator:

npm install -g generator-angular-nmi

Internationalisation

All command-line output as well as all comments within the generated files can be customised by changing the lexicon file(s) under app/locales. The generator will automatically calculate the language to use based on your OS' language settings. In case a lexicon file is not available for your OS' locale, the default English one will be used.

Additional languages

Create a new JSON file under app/locales with the ISO 639 code of your locale. If you wish to contribute locales for another language please send a PR.

What is my current locale/language?

Locale/language discovery takes place using the os-locale library which practically looks into the value defined by any of env.LC_ALL, env.LC_MESSAGES, env.LANG,env.LANGUAGE (in that order).

Testing and coverage report

istanbul cover _mocha -- -R spec

Run

yo angular-nmi

Provides usage instructions.

Single-file generators

yo angular-nmi:constant

Generates: An AngularJS Constant.
Arguments: Output folder name, module name, constant name.
Template: constant.tpl.js

Examples
Generator Generates file Module's name Resource's name
yo angular-nmi:constant src/app module1 system src/app/system.constant.js module1 SystemConstant

yo angular-nmi:controller

Generates: An AngularJS Controller.
Arguments: Output folder name, module name, controller name.
Template: controller.tpl.js

Examples
Generator Generates file Module's name Resource's name
yo angular-nmi:controller src/app module1 system src/app/system.controller.js module1 SystemController

yo angular-nmi:factory

Generates: An AngularJS Factory.
Arguments: Output folder name, module name, factory/service name.
Template: factory.tpl.js

Examples
Generator Generates file Module's name Resource's name
yo angular-nmi:factory src/app module1 control src/app/control.service.js app ControlService

yo angular-nmi:module

Generates: An AngularJS Module.
Arguments: Output folder name, module name, module filename.
Template: module.tpl.js

Examples
Generator Generates file Module's name
yo angular-nmi:module src/app/foo app.foo.suppliers suppliers src/app/foo/suppliers.module.js app.foo.suppliers

yo angular-nmi:route-ui

Generates: An AngularJS Route configuration using AngularUI Router.
Arguments: Output folder name, module name, routes name.
Template: route-ui.tpl.js

Examples
Generator Generates file Module's name
yo angular-nmi:route-ui src/app module2 app src/app/app.route.js module2

yo angular-nmi:view

Generates: An HTML view.
Arguments: Output folder name, view name.
Template: view.tpl.html

Examples
Generator Generates file
yo angular-nmi:view src/app edit src/app/edit.html

Group generators

yo angular-nmi:vc

Generates: A View and a Controller.
Arguments: Output folder name, module name, resources name.
Templates: view.tpl.html, controller.tpl.js

Examples
Generator Generates file Module's name
yo angular-nmi:vc src/app app export src/app/export.html, src/app/export.controller.js app