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

Replace chalk dependency with a lighter alternative #600

Closed
trivikr opened this issue Jul 15, 2024 · 3 comments · Fixed by #601
Closed

Replace chalk dependency with a lighter alternative #600

trivikr opened this issue Jul 15, 2024 · 3 comments · Fixed by #601

Comments

@trivikr
Copy link
Contributor

trivikr commented Jul 15, 2024

Is your feature request related to a problem? Please describe.

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 jscodeshift uses chalk

"chalk": "^4.1.2",

Describe the solution you'd like

Replace chalk with a lighter alternative, like picocolors.

@trivikr
Copy link
Contributor Author

trivikr commented Jul 15, 2024

I created a similar feature request with jscodeshift devDependencies which uses chalk:

Babel already replaced chalk with picocolors in babel/babel#16359

@Daniel15
Copy link
Member

Daniel15 commented Jul 15, 2024

What does "lighter" mean in this case? Could you please share the metrics being used?

@trivikr
Copy link
Contributor Author

trivikr commented Jul 15, 2024

What does "lighter" mean in this case? Could you please share the metrics being used?

It usually means an alternative with a smaller size (install/publish/bundle).

The dependency chalk@4.x which jscodeshift uses has ~33 kB publish size and ~105 kB install size.

Screenshot Screenshot 2024-07-15 at 8 32 55 AM

On other hand, picocolors has 5.03 kB install/publish size

Screenshot Screenshot 2024-07-15 at 8 34 10 AM

The lighter alternatives sometimes come with performance benefits too.
The picocolors benchmarks state it's 2X faster than chalk in their README.

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

Successfully merging a pull request may close this issue.

2 participants