-
Notifications
You must be signed in to change notification settings - Fork 951
refactor: replace chalk with picocolors #4599
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
base: master
Are you sure you want to change the base?
Conversation
- Replace chalk dependency with picocolors (~97% smaller) - Update type definitions to use PicocolorsColor type - Fix type error in format.ts by properly accessing color functions - Keep ChalkColor as alias for backwards compatibility - Replace chalk.grey with pc.gray (different spelling) This reduces the direct chalk dependency from ~52KB to ~1.5KB while maintaining the same functionality.
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
PR Code Suggestions ✨No code suggestions found for the PR. |
Replace manual 27-line color list with automatic type extraction: - Use Exclude<keyof typeof pc, 'isColorSupported' | 'createColors'> - Automatically stays in sync with picocolors updates - No manual maintenance needed - Reduces code from 66 to 45 lines This solves the TypeScript error when accessing colors dynamically (pc[colorName]) by ensuring only valid color function names are in the type union.
User description
This reduces the direct chalk dependency from ~52KB to ~1.5KB while maintaining the same functionality.
PR Type
Enhancement
Description
Replace chalk dependency with picocolors (~97% smaller)
Update type definitions to use PicocolorsColor type
Fix type errors in format.ts by properly accessing color functions
Keep ChalkColor as alias for backwards compatibility
Replace chalk.grey with pc.gray (different spelling)
Diagram Walkthrough
File Walkthrough
8 files
Define PicocolorsColor type and update exportsReplace chalk with picocolors and fix type errorsReplace chalk with picocolors in color selectionReplace chalk with picocolors in error loggingReplace chalk with picocolors in render methodReplace chalk with picocolors in format functionReplace chalk with picocolors in prompt generationReplace chalk with picocolors in meta function2 files
Update test assertions to use picocolorsUpdate test to use picocolors instead of chalk5 files
Update dependency from chalk to picocolorsUpdate dependency from chalk to picocolorsUpdate dependency from chalk to picocolorsUpdate dependency from chalk to picocolorsUpdate dependency from chalk to picocolors