-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Begin less reliance on async
package: Await as we go
#134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit! I've read the code here, looks like a direct replacement.
And I cross-checked the async
package's docs: https://caolan.github.io/async/v3/docs.html#waterfall, does sound like it does as you describe. It can be fancier, but it doesn't at all look like we were using the fancier bit in these files (which would have been passing result of one function to the next one).
Since our anonymous arrow functions () => {}
don't take any arguments here, I don't think we get a lot out of async.waterfall()
here indeed.
I note the try/catch
stuff was already there from before this PR, so it's not something I have to think too hard about for this PR as a reviewer, gladly.
Thanks for noticing a chance to simplify our code and use of external dependencies. Love to see it. 👍 from me!
@DeeDeeG Thanks for approval on this one! |
Yeah, sure. 👍 |
I was going to express anxiety about a last-minute merge of a change like this, but then I saw the diff… and, yes, using |
I can confirm And I can report that
So, what worked before kept working, what's broken appears to have been broken since before this PR. By the way: deduping is mostly an artifact from a time gone by, when npm didn't automatically dedupe, and running the command gives extremely finicky results. I feel it's downright risky for anyone to run it (even in vanilla npm 6 which |
Within this repo we use the
async
package nearly everywhere, which while it may have been a game changer when using CoffeeScript, I'd argue with current versions of JavaScript, this isn't really needed.Although replacing it's usage isn't always straightforward.
So what I've done here is remove the straightforward sections, which mostly consists of
async.waterfall()
which simply would run an array of async functions one after the other.Due to this simplicity I was able to easily convert any instances of
async.waterfall()
to a fewawait
calls wrapped in atry...catch
block.But I've otherwise left
async
usage in locations with more complex setups, that wouldn't be a simple translation to do. But eventually I'd hope to removeasync
as a package entirely