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

feat: Replace chalk with picocolors #15197

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

ishon19
Copy link

@ishon19 ishon19 commented Jul 18, 2024

Summary

This PR is for replacing the chalk package in the codebase with lighter and faster picocolors owing to the small bundle size (~5Kb) of picocolors as compared to the existing chalk (~48Kb).

Test plan

🚧 WIP

Fixes #15189

Copy link

linux-foundation-easycla bot commented Jul 18, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Jul 18, 2024

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 73a4051
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/66fb05e1e8fb280008ada0ec
😎 Deploy Preview https://deploy-preview-15197--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ishon19 ishon19 changed the title 15189 replace chalk with picocolors feat: Replace chalk with picocolors Jul 18, 2024
@mrazauskas
Copy link
Contributor

Probably supports-color can be also replaced by .isColorSupported from picocolors:

import {stdout as stdoutSupportsColor} from 'supports-color';

@ishon19
Copy link
Author

ishon19 commented Jul 30, 2024

Probably supports-color can be also replaced by .isColorSupported from picocolors:

import {stdout as stdoutSupportsColor} from 'supports-color';

That makes sense, thanks for pointing it out! :)

@SimenB
Copy link
Member

SimenB commented Aug 2, 2024

this might be a bit late, but maybe it helps? es-tooling/module-replacements-codemods#77

@ishon19
Copy link
Author

ishon19 commented Aug 2, 2024

this might be a bit late, but maybe it helps? es-tooling/module-replacements-codemods#77

Much helpful, thanks for sharing @SimenB!

Planning to wrap the changes up ASAP, right now stuck on yarn build failure as API extractor complains about missing d.ts type declaration file in picocolors as in the screenshot below, which they do have, but it's called picocolors.d.ts and I suspect api-extractor is picking up the wrong file, trying to override that behavior in bundleTs.mjs.

image

@mrazauskas
Copy link
Contributor

mrazauskas commented Aug 2, 2024

@ishon19 This looks like a picocolors bug. They are shipping .ts file instead of .d.ts to npm, but a package should only have .js and .d.ts.

I mean, if code is compiled using tsc, these are the only files one will have in a package.

@ishon19
Copy link
Author

ishon19 commented Aug 2, 2024

@ishon19 This looks like a bug Picolors. They are shipping .ts file instead of .d.ts to npm, but a package should only have .js and .d.ts.

I mean, if code is compiled using tsc, these are the only files one will have in a package.

Thanks @mrazauskas, yes I agree, I can create an issue on their repo for clarification.

@Kocal
Copy link

Kocal commented Sep 9, 2024

Hi everyone, I'm really interested with this PR!

@ishon19, have you had any time recently to get things moving? 🙏🏻

@mrazauskas
Copy link
Contributor

@Kocal If I get it right, this PR is still block because of alexeyraspopov/picocolors#77

@Kocal
Copy link

Kocal commented Sep 9, 2024

Thanks @mrazauskas!

@ishon19
Copy link
Author

ishon19 commented Sep 9, 2024

Hi everyone, I'm really interested with this PR!

@ishon19, have you had any time recently to get things moving? 🙏🏻

Thanks @Kocal, I know it's waiting for too long and I don't know when the issue this is waiting on is going to be resolved, so if you have any workaround or a better idea to make this happen, please feel free to link a new PR. :)

@Kocal
Copy link

Kocal commented Sep 9, 2024

Hey @ishon19, don't worry, I wasn't trying to blame you or something like that, I'm just super hyped by your PR because I also want to replace chalk by picocolors (see symfony/webpack-encore#1333 & nuxt/friendly-errors-webpack-plugin#21).

I would be really happy to help here, I will take a look today, thanks :)

@ishon19
Copy link
Author

ishon19 commented Sep 9, 2024

I would be really happy to help here, I will take a look today, thanks :)

Yeah, absolutely! Since you worked on similar issues, really appreciate your feedback :)

@Kocal
Copy link

Kocal commented Sep 30, 2024

alexeyraspopov/picocolors#82 has been merged

@ishon19
Copy link
Author

ishon19 commented Sep 30, 2024

alexeyraspopov/picocolors#82 have been merged

@Kocal Thanks for the update and the fix as well!

@alexeyraspopov
Copy link

@Kocal this change is now available in v1.1.1

@Kocal
Copy link

Kocal commented Oct 17, 2024

@alexeyraspopov thanks! :)

@ishon19
Copy link
Author

ishon19 commented Oct 17, 2024

Hey @Kocal! Since we have the official confirmation now, I believe we're all set for the upgrade!

Unfortunately at this moment, I've got a lot on my plate and I don't want to delay this upgrade any further, please feel free to take this forward if you'd like to. You can open a new PR altogether, or use this one. Let me know if I can help in any way. Appreciate your help :)

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 this pull request may close these issues.

[Feature]: Replace chalk dependency with a lighter alternative
5 participants