Skip to content

chore: replace chalk with picocolors#14837

Merged
brophdawg11 merged 2 commits into
remix-run:devfrom
roli-lpci:chore/replace-chalk-with-picocolors
Feb 27, 2026
Merged

chore: replace chalk with picocolors#14837
brophdawg11 merged 2 commits into
remix-run:devfrom
roli-lpci:chore/replace-chalk-with-picocolors

Conversation

@roli-lpci
Copy link
Copy Markdown
Contributor

Summary

Replace chalk v4 (7 transitive dependencies, ~44KB installed) with picocolors (zero dependencies, ~3KB) in create-react-router and root scripts.

Motivation:

  • react-router-dev already uses picocolors — this aligns the rest of the monorepo
  • chalk's own README recommends picocolors for simpler use cases
  • Reduces dependency footprint: chalk v4 pulls in ansi-styles, supports-color, has-flag, color-convert, color-name — picocolors is a single zero-dependency file
  • Part of the broader ecosystem effort to reduce JavaScript dependency bloat

Changes:

  • packages/create-react-router/utils.ts — swap chalk import with picocolors, update safeColor type signature
  • packages/create-react-router/package.json — replace chalk dependency with picocolors
  • scripts/version.js — swap chalkpicocolors
  • scripts/playground.js — swap chalkpicocolors, convert tagged template literals to function calls
  • package.json (root) — swap chalkpicocolors in dependencies
  • pnpm-lock.yaml — updated lockfile

Notable 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.supportsColorpc.isColorSupported
  • The safeColor wrapper and NO_COLOR support are preserved — picocolors natively respects NO_COLOR and FORCE_COLOR environment variables.

Test Plan

  • pnpm --filter create-react-router typecheck passes
  • pnpm --filter create-react-router build succeeds
  • pnpm jest packages/create-react-router — all 44 tests pass, all 12 snapshots match
  • prettier --check passes on all modified files
  • eslint passes on all modified files
  • Zero remaining chalk imports in source (grep -r "require('chalk')\|from 'chalk'" --include='*.ts' --include='*.js')

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
@remix-cla-bot
Copy link
Copy Markdown
Contributor

remix-cla-bot Bot commented Feb 27, 2026

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 CLA Signed label will be added to the pull request.

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-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 27, 2026

🦋 Changeset detected

Latest commit: 221dd1c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
create-react-router Patch
react-router Patch
react-router-dom Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
@react-router/fs-routes Patch
@react-router/express Patch
@react-router/node Patch
@react-router/remix-routes-option-adapter Patch
@react-router/serve Patch

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>
@remix-cla-bot
Copy link
Copy Markdown
Contributor

remix-cla-bot Bot commented Feb 27, 2026

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@brophdawg11 brophdawg11 self-assigned this Feb 27, 2026
@brophdawg11 brophdawg11 merged commit fdcdcef into remix-run:dev Feb 27, 2026
11 checks passed
@brophdawg11
Copy link
Copy Markdown
Contributor

Thanks!

timdorr pushed a commit to kuzznicki/react-router that referenced this pull request Mar 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version 7.13.2-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Hello there,

We just published version 7.13.2 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants