chore: replace chalk with picocolors#14837
Conversation
Replace chalk v4 (7 dependencies, 44KB installed) with picocolors (zero dependencies, ~3KB) across create-react-router and root scripts. - Migrate `packages/create-react-router/utils.ts` to use picocolors API - Migrate `scripts/version.js` and `scripts/playground.js` - Add inline ANSI true-color hex formatter for loading indicator gradient (replaces `chalk.hex()` which has no picocolors equivalent) - Use `pc.isColorSupported` instead of `chalk.supportsColor` - Update `logBullet` parameter types from generic to concrete string type - All 44 existing tests pass with no changes The react-router-dev package already uses picocolors, so this aligns create-react-router with the rest of the monorepo. Ref: https://github.com/nicolo-ribaudo/chalkless
|
Hi @roli-lpci, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
🦋 Changeset detectedLatest commit: 221dd1c The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
|
Thanks! |
|
🤖 Hello there, We just published version Thanks! |
|
🤖 Hello there, We just published version Thanks! |
Summary
Replace
chalkv4 (7 transitive dependencies, ~44KB installed) withpicocolors(zero dependencies, ~3KB) increate-react-routerand root scripts.Motivation:
react-router-devalready usespicocolors— this aligns the rest of the monorepoansi-styles,supports-color,has-flag,color-convert,color-name— picocolors is a single zero-dependency fileChanges:
packages/create-react-router/utils.ts— swapchalkimport withpicocolors, updatesafeColortype signaturepackages/create-react-router/package.json— replacechalkdependency withpicocolorsscripts/version.js— swapchalk→picocolorsscripts/playground.js— swapchalk→picocolors, convert tagged template literals to function callspackage.json(root) — swapchalk→picocolorsin dependenciespnpm-lock.yaml— updated lockfileNotable implementation detail:
chalk.hex()(used for the loading indicator gradient animation) has no picocolors equivalent. Replaced with a small inline function that emits ANSI true-color (24-bit) escape sequences directly, which are widely supported on Node >= 20 (the repo's minimum).chalk.supportsColor→pc.isColorSupportedsafeColorwrapper andNO_COLORsupport are preserved — picocolors natively respectsNO_COLORandFORCE_COLORenvironment variables.Test Plan
pnpm --filter create-react-router typecheckpassespnpm --filter create-react-router buildsucceedspnpm jest packages/create-react-router— all 44 tests pass, all 12 snapshots matchprettier --checkpasses on all modified fileseslintpasses on all modified fileschalkimports in source (grep -r "require('chalk')\|from 'chalk'" --include='*.ts' --include='*.js')