Closed tonydangblog closed 7 months ago
Nice!
Did you look into using Stream.map
for this instead? The previous code is slightly more readable but I do like your solution more as it solves a real issue. We might be able to keep the previous code with your fix by using Stream.map
. But I'm unsure if that would work, would have to test it myself but since you're already working on it might be faster if you check. If it doesn't work then feel free to just say so and I'll merge :)
I haven't looked at using Stream.map
yet, but I can definitely take a look. I'm out the rest of this weekend, but will try it out first chance I get and let you know!
I took another look and realized I was overcomplicating things. The Enum
module functions already runs things synchronously so there was no need to use Task.async
and Task.await
. I refactored the code to be a simple and clear one-liner using Enum.each
. Please see the latest commit and lmk if things look better now!
Nice, even better!
Summary
Change LiveSvelte setup tasks to run synchronously.
Reason for change
Currently the setup tasks run asynchronously. However this could lead to jumbled terminal output such as in the following screenshot:
This is not ideal because the user installing
live_svelte
may miss the prompt for the file overwrite and think that the process just hung. (This is what happened to me and it took a while to figure out what was wrong 😅). Changing the setup tasks to run synchronously will show a clearer output to the user: