Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending angular yeoman generator

I basically want to create a custom yeoman generator that by default extends the standard generator-angular npm package. (by extending I mean giving access to all its sub generators)

Right now what I'm doing is that I have set up all angular sub generators by replicating all the subfolders structure and creating almost-empty js files to just handle the sub generator to the generator-angular package.

I wonder if there is a better way to do it, like specifying sub generator classes somewhere in the code or in a configuration file.

like image 746
ruyadorno Avatar asked Jul 14 '26 14:07

ruyadorno


1 Answers

Yeoman generator a raw JavaScript prototyped object. Just extend them like you'd do it normally with any other JavaScript object.

var util = require('util'); // standard Node.js lib
var BaseGenerator = require('./base/generator');

function AngGenerator() {
    BaseGenerator.apply( this, arguments );
}
util.inherit( AppGenerator, BaseGenerator );

You can do the same with the Generator-Angular NPM module, and the same with any sub-generator.

like image 76
Simon Boudrias Avatar answered Jul 16 '26 04:07

Simon Boudrias



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!