refactor: replace chalk with picocolors#4599
Conversation
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. |
2dc2efd to
f851c23
Compare
9b3a772 to
f851c23
Compare
- 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.
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.
f851c23 to
6a8c27c
Compare
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