bharathnayak03 / svg-wc-icons

Generate WebComponents from svg icons
11 stars 1 forks source link

[improvement] instead of logging 100 success logs, print one log. #8

Open itaditya opened 4 years ago

itaditya commented 4 years ago

Currently the log looks like this

image

Instead we can do something like

# in greeen
Generated 100/104 web-components successfully.

# in red
Couldn't generate 4/104 web-components.
Failed for icon-a.svg, icon-b.svg ...
itaditya commented 4 years ago

I got a better idea 🎉

using cursorTo we can overwrite the console logs so that everything happens on one line.

So it would look something like

Successfully generated /some/path/icon-success.svg

then it will be overwritten by

Successfully generated /some/path/icon-clock.svg

similarly it will keep on overwriting till all successful transforms happen.

Then in the end it will log

# in greeen
Generated 100/104 web-components successfully.

# in red
Couldn't generate 4/104 web-components.
Failed for icon-a.svg, icon-b.svg ...

Usage of this method here- https://stackoverflow.com/a/34570694/6488776