Skip to content
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

[Feature]: Replace chalk dependency with a lighter alternative #15189

Open
trivikr opened this issue Jul 15, 2024 · 10 comments · May be fixed by #15197
Open

[Feature]: Replace chalk dependency with a lighter alternative #15189

trivikr opened this issue Jul 15, 2024 · 10 comments · May be fixed by #15197

Comments

@trivikr
Copy link
Contributor

trivikr commented Jul 15, 2024

🚀 Feature Proposal

Replace chalk dependency with a lighter alternative

Motivation

Recently, the Ecosystem Performance was formed to cleanup, speedup, levelup the JavaScript Ecosystem.
Socket Security team wrote a blog post about it https://socket.dev/blog/javascript-community-launches-e18e-initiative-to-improve-ecosystem-performance

On the e18e cleanup channel on Discord, multiple solutions are being discussed. One of them is to replace chalk with picocolors.

I see that jest uses chalk

"chalk": "^4.0.0",

And it's upgrade to [email protected] is blocked since it's ESM only #14253 (comment)

Example

No response

Pitch

Replace chalk with a lighter alternative like picocolors.

@SimenB
Copy link
Member

SimenB commented Jul 15, 2024

Happy to take a PR switching to picocolors (which babel etc. uses) or something else if there are better alternatives 👍

@ishon19
Copy link

ishon19 commented Jul 15, 2024

Hey @SimenB, I would like to work on this issue!

Also, I went through a bunch of relevant npm packages (kleur, colorette, etc.) and I also feel like picocolors would be the best option here, as it beats others in terms of the package size.

@SimenB
Copy link
Member

SimenB commented Jul 16, 2024

Sweet thanks! Looking forward to it 👍

@sindresorhus
Copy link

I recommend reading this: https://github.com/chalk/chalk#why-not-switch-to-a-smaller-coloring-package

@ishon19
Copy link

ishon19 commented Aug 13, 2024

I recommend reading this: https://github.com/chalk/chalk#why-not-switch-to-a-smaller-coloring-package

Thanks for sharing the link @sindresorhus and I agree to a great extent, smaller packages somewhere fall short on providing the range of colors, something which I experienced in the linked draft PR, not to mention the package specific quirks that need to be accommodated on top of that.

@SimenB
Copy link
Member

SimenB commented Aug 14, 2024

Fair enough, but for jest specifically that probably doesn't apply as much:

  • we pull in Babel which has already made the change, so we don't add extra deps
  • we're not gonna move to ESM anytime soon, so we're stuck on older versions where the deduplication benefit isn't as good (and will regress as time goes on)

@trivikr
Copy link
Contributor Author

trivikr commented Sep 4, 2024

I would like to work on this issue!

@ishon19 Are you still working on this?

My PR on changesets was just merged and released changesets/changesets#1417, and I don't mind taking this up.

@ishon19
Copy link

ishon19 commented Sep 5, 2024

@ishon19 Are you still working on this?

My PR on changesets was just merged and released changesets/changesets#1417, and I don't mind taking this up.

Hey @trivikr, that's awesome! Sure, you can take this up if you'd like to. I was stuck on the type extraction; the yarn build was failing as API Extractor couldn't extract picocolors type, I created an issue with picocolors too (linked in the draft PR) but haven't received any official response yet.

@trivikr
Copy link
Contributor Author

trivikr commented Sep 5, 2024

linked in the draft PR

My bad. I see that you've already posted PR on Jul 18th which I didn't know about
#15197

Thank you for posting the PR, and following up with the maintainer.

@ishon19
Copy link

ishon19 commented Sep 5, 2024

My bad. I see that you've already posted PR on Jul 18th which I didn't know about #15197

Thank you for posting the PR, and following up with the maintainer.

No problem! Hoping to get a response from the maintainer soon so that we're good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants