Skip to content

chore(deps): replace chalk with picocolors#2763

Open
roli-lpci wants to merge 1 commit intocucumber:mainfrom
roli-lpci:chore/replace-chalk-with-picocolors
Open

chore(deps): replace chalk with picocolors#2763
roli-lpci wants to merge 1 commit intocucumber:mainfrom
roli-lpci:chore/replace-chalk-with-picocolors

Conversation

@roli-lpci
Copy link

Summary

  • Replace chalk (4 transitive deps: chalk, ansi-styles, supports-color's dep has-flag) with picocolors (zero deps) for terminal color output
  • Map new chalk.Instance(support) to picocolors.createColors(!!support) — supports-color returns false for no-support and {level: 1|2|3} for support, so the boolean coercion preserves the same enable/disable semantics
  • All colors used (red, green, yellow, cyan, gray) are basic ANSI codes, so the level-to-boolean mapping has no visual impact
  • Normalize chalk.grey to picocolors.gray (both emit ANSI code 90)
  • Eliminate the manual identity-function fallback branch — createColors(false) handles this automatically

Changes

  • src/formatter/get_color_fns.ts — Replace chalk.Instance + bind pattern with picocolors.createColors, simplify from 46 lines to 30
  • features/support/warn_user_about_enabling_developer_mode.ts — Replace chalk.red() with pc.red()
  • package.json — Swap chalk for picocolors in dependencies
  • package-lock.json — Regenerated

Notes

  • supports-color is intentionally kept — it is used by src/publish/publish_plugin.ts outside of the chalk context
  • Prior chalk v5 upgrade PR (fix(deps): update dependency chalk to v5 #1914) was closed — chalk v5 is ESM-only while cucumber-js has CJS exports. Picocolors supports both CJS and ESM.

Testing

  • 408 unit tests passing
  • TypeScript build clean
  • Prettier clean
  • ESLint clean
  • dependency-lint clean

Replace chalk (4 transitive deps) with picocolors (zero deps) for
terminal color output. The `chalk.Instance(support)` pattern is
replaced with `picocolors.createColors(!!support)`, which provides
the same enable/disable behavior since `supports-color` already
returns `false` for no-support and `{level: 1|2|3}` for support.

All colors used (red, green, yellow, cyan, gray) are basic ANSI
codes, so the level→boolean flattening has no visual impact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant