-
-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate the core and the generator instances #315
Comments
Checked a bit while coding today, and there's already three modules being inserted out of the generator context here: https://github.com/yeoman/generator/blob/master/lib/base.js#L92-L94 - so they're #1 candidates. And then I realized that really only the I believe this would be cleaner than using instances methods (plus it liberate devs from the hassle of |
I'm 👍 to us opting for moving towards instance methods. |
👍 |
That sounds like a good enough reason for me! On top of decoupling the utility methods from the Generator instance it would be nice to auto-bind the methods that need to run in the context of the Generator so we can pass them around without having to bind them every time. Decoupling may take some effort but just binding the methods shouldn't take so much, I could do it if everybody is OK with the idea. |
This issue is stale because it has been open 15 days with no activity. Remove stale label or comment or this will be closed in 5 days |
At the moment, every Yeoman helper function is directly linked to the generator instance (
this.write
,this.log
,this.spawn
, etc).This is good for a lot of them as they need to be executed in context, but for a lot of other methods, that's not really the case.
I wonder if it wouldn't be cleaner to separate the generator instances from the utility functions. And instead of calling
this.spawn
, being able to callyo.spawn
.I haven't check exactly which methods are context independent, so maybe there's not enough to make it worthwhile.
The text was updated successfully, but these errors were encountered: