Conversation
lydell
left a comment
There was a problem hiding this comment.
Great! Pretty funny that we depended on a whole library plus sub dependencies just to make some text blue and red 😅
|
I think we should go one step further with supports-color and simplify it even more. This is what we have documented: https://github.com/rtfeldman/node-test-runner#--no-color
We only allow So I think we only need to take into account:
I think we can assume that all terminals these days, including cmd.exe and CI services, support basic blue and red. |
|
Yes that sounds good 👍 I've simplified it a bit more with your suggestions. We can simplify more but that would probably mean being slightly incorrect in some corner case/environment, and I don't feel confident calling the shot. Feel free to edit this further! |
Vendors the
chalkdependency, getting rid of a few indirect dependencies too.chalkdoes quite a lot of complicated work to enable complex usages (chalk.blue.underline(...), template literals, ...), whereas we only use it to dochalk.red()andchalk.blue()(and that's it).We also
chalkit to figure out whether the output supports colors, but that is handled by the sub-dependencysupports-color.I've vendored both dependencies, and simplified them.
chalkis now extremely simple, andsupports-coloris simplified a bit (I've done it in steps for it to be understandable, or even replicable later). Simplifying these dependencies mean startup should be faster 🤞I'm still on the fence for vendoring
supports-color(but leaning towards doing it) as we will now receive new updates for it. That said, the latest version is already incompatible with this CLI, as it's ESM only. Therefore we won't get any updates until we switch to ESM (thereby dropping Node.js v12 compatibility).