yeoman-app
yeoman-app copied to clipboard
Issue with new yeoman-generator version
I could not get any generators working that were using yeoman-generator@^1.0.0. I keep getting the following error:
TypeError: Cannot read property 'then' of undefined
at <generator_name>.Base.prompt (.../node_modules/<generator_name>/node_modules/yeoman-generator/lib/index.js:168:44)
(generator-licence is an easy one to test)
Starting from [email protected], Base#prompt()
functions now returns a promise instead of taking a callback parameter:
prompting: function () {
return this.prompt(questions).then(function (answers) {
this.answers = answers;
}.bind(this));
}
So I think the adapter need to be updated to use a promise instead of a callback. Or maybe returning both to be compatible with more generators.
FIX
In yo/adapter.js
ProcessAdapter.prototype.prompt = function (questions, callback) {
process.send({
event: 'generator:prompt-questions',
data: questions
});
if (callback){
this.answerCallback = callback;
} else {
return new Promise((resolve) => {
this.answerCallback = resolve;
});
}
};
@R0muald do you want to send a PR?
This project isn't actively maintained anymore, but I'll gladly help you get some fixes in.