I'm trying to use composeWith
, to call a subgenerator within the same generator package. Yet for some reason, only the constructor of the called generator is invoked.
My generator-package generator-test
looks like this:
package.json
generators
-- app
-- index.js
-- base
-- index.js
My main generator in app
looks like this:
'use strict';
var yeoman = require('yeoman-generator');
var yosay = require('yosay');
module.exports = yeoman.generators.Base.extend({
constructor: function () {
console.log('constructing app');
yeoman.generators.Base.apply(this, arguments);
},
initializing: function() {
console.log('initializing app');
var done = this.async();
this.composeWith('test:base',{ options: { } })
.on('end', function() {
done();
});
}
});
My subgenerator in base
:
'use strict';
var yeoman = require('yeoman-generator');
module.exports = yeoman.generators.Base.extend({
constructor: function () {
console.log('constructed base');
yeoman.generators.Base.apply(this, arguments);
},
initializing: function() {
console.log('initialized base');
}
});
This should generate 4 console outputs, yet I am only getting the first three:
constructing app
initializing app
constructed base
initialized base
is never displayed. Why? Am I misunderstanding the concept of composeWith
?
Or is there another way to solve this?