Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is something I've been chipping away at. Only about half done at the moment but I thought I should push it in case I forget about it and someone else wants to pick it up and to collect intermediate feedback on my approach if anyone wants to weigh in.
The aim here is to embrace modern JS, >= Node 10 style. So primarily
async
/await
and the various pieces of syntactic sugar that we haven't yet embraced here (template strings, arrow functions, no morevar
, etc.). Secondarily is to clean up the style a bit to make it more clear and get rid of the huge nesting that's been piling up since the original code and make it more maintainable in the process. In the process I'd like to expose more of the code for testing, so it'll probably meaning splitting out more files that are focused on just one thing that can be isolated and tested.test/ should all be done I think, lib/ is where the bulk of the remaining work is.
There's a couple of places where
new Promise()
appears in this WIP code that will eventually be factored out, they're just used as bridging points between callback and async/await style so the tests still pass. In the end I think the only place explicitnew Promise()
will appear is around child_process work which is still hard to promisify nicely, but I think that should probably all be factored out into a single place to avoid the duplication.