Problem with installDependencies
I have problem with installDependencies method. I researched this problem and found possible problem. I think that main problem in runInstall method
}.bind(this), { once: installer + ' ' + args.join(' '), run: false });
https://github.com/yeoman/generator/blob/master/lib/actions/install.js#L52
After that I replaced run: false to run: true it would be all ok. I'm not understand infrastructure at all, I don't create pull request.
This is not your issue.
Setting run to false just doesn't triggers a run on it's own unless yeoman launch the event loop.
Maybe try explaining the context of the problem you're having.
Closing for now as this doesn't seem to be an issue with yeoman-generator. Feel free to continue the discussion if you need further support.
Thx for help. I understand my problem.
I use installDependencies after end event. But as i think event loop starts before this event.
//It's wrong
this.on('end', function () {
this.installDependencies({ skipInstall: this.options['skip-install'] });
});
Main problem is that this code worked earlier, but now it's not problem))
//solution
//this.on('end', function () {
this.installDependencies({ skipInstall: this.options['skip-install'] });
//});
@lexich I am experiencing the same issues as you in as much as installDependencies() works if I take it out of the this.on('end'. Is this okay to keep or is there a problem with the generator? Should we be waiting for another event to install deps?
No, calling installDependencies automatically set up the run loop. The thing is that when the end event is triggered, the generator is done doing all it's work and won't run anything else.
Events are for external use (like platform integrating generators), not for the generator itself.
@SBoudrias thanks, but just so I'm clear, will installDependencies always be called at the correct time? i.e after the generator has done everything else?
Yes!
Good to know, thanks.