Skip to content

Conversation

@richiemccoll
Copy link

Description

This PR addresses the comment here by adding a new Codemod migration guide for the new recipe: chalk-to-util-styletext.

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@richiemccoll richiemccoll requested a review from a team as a code owner December 19, 2025 13:11
Copilot AI review requested due to automatic review settings December 19, 2025 13:11
@vercel
Copy link

vercel bot commented Dec 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nodejs-org Ready Ready Preview Jan 6, 2026 9:05am

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a migration guide for developers transitioning from the Chalk library to Node.js's native util.styleText functionality. The guide documents a new codemod that automates this migration process.

  • Introduces comprehensive documentation for the chalk-to-util-styletext codemod
  • Documents compatible and non-compatible features between Chalk and Node.js util.styleText
  • Provides practical before/after code examples demonstrating the migration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.02%. Comparing base (8c5a7dd) to head (e5c3580).
⚠️ Report is 22 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8430      +/-   ##
==========================================
+ Coverage   74.70%   75.02%   +0.31%     
==========================================
  Files         102      103       +1     
  Lines        8956     9041      +85     
  Branches      305      311       +6     
==========================================
+ Hits         6691     6783      +92     
+ Misses       2263     2256       -7     
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@mikeesto mikeesto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay nice ! but few things:

  • you have to add you as authors on blog https://github.com/nodejs/nodejs.org/blob/main/apps/site/authors.json
  • a mention of when styleText became stable and if you are on app verify that you are on the right version (on prod). And if you are using it on package the user have to check their nodejs version support and reming them that changing node.js version support is a major bump on their package
  • last but no least a paragraph to thanks the maintainer. because without npm ecosystem node can't exist.

Copy link
Contributor

@bmuenzenmeyer bmuenzenmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love to see this! nice work!


## `chalk-to-util-styletext`

This codemod aims to help you reduce external dependencies by transforming chalk method calls to use the native Node.js styling functionality. It will also handle automatic removal of the `chalk` package from the package.json.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This codemod aims to help you reduce external dependencies by transforming chalk method calls to use the native Node.js styling functionality. It will also handle automatic removal of the `chalk` package from the package.json.
This codemod aims to help you reduce external dependencies by transforming chalk method calls to use the native Node.js styling functionality. It will also handle automatic removal of the [`chalk`](https://github.com/chalk/chalk) package from the package.json.


- Node.js v20.12.0 or later (for util.styleText)
- `util.styleText` became stable in Node.js v22.13.0 (and v23.5.0)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> **Friend reminder**
> If your package supports a version earlier than 22, this creates a breaking change, which means you must bump the major version of your package.


const boldBlue = text => styleText(['blue', 'bold'], text);
console.log(boldBlue('Info'));
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```
```
## Recognition
We would like to thank the maintainers of `chalk` for their support of the package over time and for its contributions to the ecosystem.
```

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.

4 participants