From 9ca6fea519366830425ea2055ececd8b716628d7 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Fri, 22 May 2026 12:07:34 +0200 Subject: [PATCH 1/4] docs: add nodejs/userland-migrations codemod --- docs/modules/chalk.md | 6 ++++++ docs/modules/fetch.md | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/docs/modules/chalk.md b/docs/modules/chalk.md index 9f9e8e21..8a1fc98c 100644 --- a/docs/modules/chalk.md +++ b/docs/modules/chalk.md @@ -8,6 +8,10 @@ description: Modern alternatives to the chalk package for terminal string stylin Since Node 20.x, you can use the [`styleText`](https://nodejs.org/api/util.html#utilstyletextformat-text-options) function from the `node:util` module to style text in the terminal. +> [!TIP] +> You can use `npx codemod @nodejs/chalk-to-util-styletext` codemod to help migrate from chalk to `styleText` + + Example: ```ts @@ -27,6 +31,8 @@ console.log(`I am ${styleText(['blue', 'bgRed'], 'blue on red')}!`) // [!code ++ > [!NOTE] > `styleText` does not support RGB and hex colors (e.g. `#EFEFEF` or `255, 239, 235`). You can view the available styles in the [Node documentation](https://nodejs.org/api/util.html#modifiers). +> +> Since v26.1.0 the `styleText` API support hex colors eg: `styleText('#ff5733', 'Orange text')`. ## `picocolors` diff --git a/docs/modules/fetch.md b/docs/modules/fetch.md index 4034ab49..edf45110 100644 --- a/docs/modules/fetch.md +++ b/docs/modules/fetch.md @@ -10,6 +10,10 @@ This page contains the common, recommended alternatives and examples for fetch b The native [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API is available in Node.js (since v18.x) and all modern browsers. For many use cases it replaces `axios`/`node-fetch`/`cross-fetch` without adding dependencies. +> [!TIP] +> You can use `npx codemod@latest @nodejs/axios-to-whatwg` codemod to help migrate from axios to built-in fetch + + Example: ```ts From 55a81b9dfd4e36fe0af78e8ed9c4592c731a9118 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Fri, 22 May 2026 13:38:06 +0200 Subject: [PATCH 2/4] apply suggestion Co-Authored-By: James Garbutt <43081j@users.noreply.github.com> --- docs/modules/chalk.md | 9 ++++----- docs/modules/fetch.md | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/modules/chalk.md b/docs/modules/chalk.md index 8a1fc98c..cd9b6c2e 100644 --- a/docs/modules/chalk.md +++ b/docs/modules/chalk.md @@ -9,8 +9,7 @@ description: Modern alternatives to the chalk package for terminal string stylin Since Node 20.x, you can use the [`styleText`](https://nodejs.org/api/util.html#utilstyletextformat-text-options) function from the `node:util` module to style text in the terminal. > [!TIP] -> You can use `npx codemod @nodejs/chalk-to-util-styletext` codemod to help migrate from chalk to `styleText` - +> Node.js provides a codemod which can migrate some of this automatically, see the docs at [@nodejs/chalk-to-util-styletext](https://app.codemod.com/registry/@nodejs/chalk-to-util-styletext) for more details. Example: @@ -20,6 +19,8 @@ import chalk from 'chalk' // [!code --] console.log(`Hello ${chalk.blue('blue')} world!`) // [!code --] console.log(`Hello ${styleText('blue', 'blue')} world!`) // [!code ++] +console.log(`I am ${chalk.hex('#ec8f5e')('hex color')}!`) // [!code --] +console.log(`I am ${styleText('#ec8f5e', 'hex color')}!`) // [!code ++] ``` When using multiple styles, you can pass an array to `styleText`: @@ -30,9 +31,7 @@ console.log(`I am ${styleText(['blue', 'bgRed'], 'blue on red')}!`) // [!code ++ ``` > [!NOTE] -> `styleText` does not support RGB and hex colors (e.g. `#EFEFEF` or `255, 239, 235`). You can view the available styles in the [Node documentation](https://nodejs.org/api/util.html#modifiers). -> -> Since v26.1.0 the `styleText` API support hex colors eg: `styleText('#ff5733', 'Orange text')`. +> Before Node v26.1.0, `styleText` did not support hex colors or RGB colors (e.g. `#EFEFEF` or `255, 239, 235`). Hex colors are supported starting in v26.1.0, but RGB colors are still not supported. You can view the available styles in the [Node documentation](https://nodejs.org/api/util.html#modifiers). ## `picocolors` diff --git a/docs/modules/fetch.md b/docs/modules/fetch.md index edf45110..e68179cc 100644 --- a/docs/modules/fetch.md +++ b/docs/modules/fetch.md @@ -11,7 +11,7 @@ This page contains the common, recommended alternatives and examples for fetch b The native [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API is available in Node.js (since v18.x) and all modern browsers. For many use cases it replaces `axios`/`node-fetch`/`cross-fetch` without adding dependencies. > [!TIP] -> You can use `npx codemod@latest @nodejs/axios-to-whatwg` codemod to help migrate from axios to built-in fetch +> Node.js provides a codemod which can migrate some of this automatically, see the docs at [@nodejs/axios-to-whatwg](https://app.codemod.com/registry/@nodejs/axios-to-whatwg) for more details. Example: From 9e83a6b76eeae91555a9bd041f5e13e559d16547 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Fri, 22 May 2026 16:00:59 +0200 Subject: [PATCH 3/4] Update docs/modules/fetch.md Co-authored-by: Roman --- docs/modules/fetch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/fetch.md b/docs/modules/fetch.md index e68179cc..13cfdf95 100644 --- a/docs/modules/fetch.md +++ b/docs/modules/fetch.md @@ -11,7 +11,7 @@ This page contains the common, recommended alternatives and examples for fetch b The native [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) API is available in Node.js (since v18.x) and all modern browsers. For many use cases it replaces `axios`/`node-fetch`/`cross-fetch` without adding dependencies. > [!TIP] -> Node.js provides a codemod which can migrate some of this automatically, see the docs at [@nodejs/axios-to-whatwg](https://app.codemod.com/registry/@nodejs/axios-to-whatwg) for more details. +> Node.js provides a codemod which can migrate some of this automatically, see the docs at [@nodejs/axios-to-whatwg-fetch](https://app.codemod.com/registry/@nodejs/axios-to-whatwg-fetch) for more details. Example: From e6faa7a3e26b5fe239e810df6188ccf58ea046da Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Fri, 22 May 2026 19:41:00 +0100 Subject: [PATCH 4/4] chore: run format --- docs/modules/fetch.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/modules/fetch.md b/docs/modules/fetch.md index 13cfdf95..6afd6401 100644 --- a/docs/modules/fetch.md +++ b/docs/modules/fetch.md @@ -13,7 +13,6 @@ The native [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) > [!TIP] > Node.js provides a codemod which can migrate some of this automatically, see the docs at [@nodejs/axios-to-whatwg-fetch](https://app.codemod.com/registry/@nodejs/axios-to-whatwg-fetch) for more details. - Example: ```ts