-
-
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
mem-fs-editor#commit callback or similar hook #1273
Comments
I think that the best option is to monkey patch fs.commit
|
You can try this (after commit priority: install or end):
|
Many thanks, @tonyhallett, and @mshima. I will try solutions offered. |
Maybe you need to pass
|
@mshima, what does Should I use |
By default an identical file will be written to file, so the above suggestion will not work. generator/lib/util/conflicter.js Line 44 in bfd02b3
|
Is |
Works when you create your generator like:
|
@mshima, is the following correct?
|
@ozum exactly |
@mshima, I got |
My bad, it’s sharedFs. Updated the example. |
@mshima, thanks for the responses and your time. Just a typo: I would be grateful if you help one more thing. Since |
@ozum The environment is an event emitter This might be what you are looking for
|
Thanks, @tonyhallett. Could you please give more details? Where to put the code below and what is the difference between this.runLoop.on('end', () => {
resolve();
this.emit('end');
}); |
Sorry this is the code from environment. You should listen for the end event on this.env |
I think it is this.env.on('end',CB) |
Another idea. Add a custom queue that runs after end. |
Thanks @tonyhallett for the suggestions. |
Options.customPriorities is an array. Object with priorityName that matches the method name that does the work. The queue will be added after end. |
Hi,
TLDR;
My generator creates and updates files. I'm providing an uninstall method to undo changes made by my generator. I need to know whether each conflicted file is written to disk or rejected by the user.
AFAIK, currently, it is not possible. It would be very nice to have a hook, callback, etc. to get informed whether a conflicted file is written to disk or not. I'm sorry if it is already possible and I missed it. Any help is appreciated.
Details
First, I thought that I can use the
commit
method's callback to get whether a conflict is accepted or rejected, but it is not documented in Yeoman API docs. I assumed it is an undocumented feature and should be avoided and also read the following in docs:Now, I am doing it in a very bad way. I read files at the beginning and reread them at the end to compare and decide whether they are accepted or rejected. Of course, this destroys all advantages of the
mem-fs
memory file system.Many thanks,
The text was updated successfully, but these errors were encountered: