diff --git a/apps/site/pages/en/blog/migrations/v12-to-v14.mdx b/apps/site/pages/en/blog/migrations/v12-to-v14.mdx index 4193e1d6e57a3..58d1753f524d8 100644 --- a/apps/site/pages/en/blog/migrations/v12-to-v14.mdx +++ b/apps/site/pages/en/blog/migrations/v12-to-v14.mdx @@ -18,7 +18,7 @@ This page provides a list of codemods to help you migrate your code from Node.js ## `util-print-to-console-log` -This recipe transforms calls of various now-deprecated `node:util` log functions into the modern alternative, `console.log` and `console.error`: +This codemod transforms calls of various now-deprecated `node:util` log functions into the modern alternative, `console.log` and `console.error`: - [DEP0026](https://nodejs.org/api/deprecations.html#DEP0026): `util.print` → `console.log` - [DEP0027](https://nodejs.org/api/deprecations.html#DEP0027): `util.puts` → `console.log` diff --git a/apps/site/pages/en/blog/migrations/v14-to-v16.mdx b/apps/site/pages/en/blog/migrations/v14-to-v16.mdx index df17882b0655a..d3dae0e804cc7 100644 --- a/apps/site/pages/en/blog/migrations/v14-to-v16.mdx +++ b/apps/site/pages/en/blog/migrations/v14-to-v16.mdx @@ -76,32 +76,6 @@ if (require.main === 'mod.js') { } ``` -## `process-mainModule-to-require-main` - -The [`process.mainModule`](https://nodejs.org/api/process.html#process_process_mainmodule) property was deprecated ([DEP0144](https://nodejs.org/api/deprecations.html#DEP0144)) in favor of [`require.main`](https://nodejs.org/api/modules.html#modules_accessing_the_main_module). This codemod replaces calls of the deprecated property with the modern alternative mentioned. - -The source code for this codemod can be found in the [process-mainModule-to-require-main directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/process-main-module). - -You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/process-mainModule-to-require-main). - -```bash -npx codemod run @nodejs/process-mainModule-to-require-main -``` - -### Example: - -```js displayName="Before" -if (process.mainModule) { - console.log('This script is the main module'); -} -``` - -```js displayName="After" -if (require.main === module) { - console.log('This script is the main module'); -} -``` - ## `rmdir` The `fs.rmdir` function was deprecated in favor of `fs.rm` with the `{ recursive: true }` option. This codemod will help you replace the old `fs.rmdir` function with the new `fs.rm` function. @@ -119,6 +93,8 @@ npx codemod run @nodejs/rmdir ### Example: ```js displayName="Before" +const fs = require('node:fs'); + // Using fs.rmdir with the recursive option fs.rmdir(path, { recursive: true }, callback); @@ -130,6 +106,8 @@ fs.promises.rmdir(path, { recursive: true }); ``` ```js displayName="After" +const fs = require('node:fs'); + // Using fs.rm with recursive and force options fs.rm(path, { recursive: true, force: true }, callback); diff --git a/apps/site/pages/en/blog/migrations/v22-to-v24.mdx b/apps/site/pages/en/blog/migrations/v22-to-v24.mdx index ff9dabb591acf..116edd2e66d94 100644 --- a/apps/site/pages/en/blog/migrations/v22-to-v24.mdx +++ b/apps/site/pages/en/blog/migrations/v22-to-v24.mdx @@ -3,7 +3,7 @@ date: '2025-10-28T00:03:00.000Z' category: migrations title: Node.js v22 to v24 layout: blog-post -author: AugustinMauroy +author: AugustinMauroy, Richard Lau --- # Node.js v22 to v24 @@ -67,11 +67,11 @@ Node.js' `configure` script will warn if you attempt to build Node.js with a com ## Available Codemods -Some breaking changes or End of Life deprecations in Node.js 23 and 24 have associated codemods to help you update your codebase. Below is a list of the available codemods for this migration: +Some breaking changes or End of Life (EOL) deprecations in Node.js 23 and 24 have associated codemods to help you update your codebase. Below is a list of the available codemods for this migration: ### `fs-access-mode-constants` -In Node.js 24, the `fs` module introduced a runtime deprecation for `F_OK`, `R_OK`, `W_OK`, and `X_OK` getters exposed directly on `node:fs`. Get them from `fs.constants` or `fs.promises.constants` instead. +The `fs` module introduced a runtime deprecation for `F_OK`, `R_OK`, `W_OK`, and `X_OK` getters exposed directly on `node:fs`. Get them from `fs.constants` or `fs.promises.constants` instead. This codemod handles [DEP0176](https://nodejs.org/api/deprecations.html#DEP0176). @@ -101,7 +101,7 @@ fs.access('/path/to/file', fs.constants.R_OK | fs.constants.W_OK, callback); ### `util-log-to-console-log` -In Node.js v23, the `util.log` function was deprecated in favor of using `console.log` directly. Because it's an unmaintained legacy API that was exposed to user land by accident +The `util.log` function was deprecated in favor of using `console.log` directly, because it's an unmaintained legacy API that was exposed to user land by accident. So this codemod handle [DEP0059](https://nodejs.org/api/deprecations.html#DEP0059). @@ -109,7 +109,7 @@ So this codemod handle [DEP0059](https://nodejs.org/api/deprecations.html#DEP005 npx codemod run @nodejs/util-log-to-console-log ``` -### Example: +#### Example: ```js displayName="Before" const util = require('node:util'); @@ -191,7 +191,7 @@ open('file.txt', 'w', (err, fd) => { ### `crypto-rsa-pss-update` -Codemod to handle Node.js crypto deprecation [DEP0154](https://nodejs.org/docs/latest/api/deprecations.html#DEP0154) by transforming deprecated RSA-PSS key generation options. +In [DEP0154](https://nodejs.org/docs/latest/api/deprecations.html#DEP0154), the `generateKeyPair` and `generateKeyPairSync` methods in the `crypto` module deprecated the `hash`, `mgf1Hash`, and `saltLength` options for the `'rsa-pss'` key type in favor of `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` respectively. The source code for this codemod can be found in the [crypto-rsa-pss-update directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/crypto-rsa-pss-update). @@ -221,7 +221,7 @@ crypto.generateKeyPair( ``` ```js displayName="After" -const crypto = require('crypto'); +const crypto = require('node:crypto'); crypto.generateKeyPair( 'rsa-pss', diff --git a/apps/site/site.json b/apps/site/site.json index 4ef62998f1413..22381906522cf 100644 --- a/apps/site/site.json +++ b/apps/site/site.json @@ -37,12 +37,12 @@ }, "websiteBadges": { "index": { - "startDate": "2025-04-01T00:00:00.000Z", - "endDate": "2025-07-01T00:00:00.000Z", + "startDate": "2025-10-30T00:00:00.000Z", + "endDate": "2025-11-15T00:00:00.000Z", "kind": "default", - "title": "JSConf", - "text": "Get your tickets now!", - "link": "https://events.linuxfoundation.org/jsconf-north-america" + "title": "Discover", + "text": "New migration guides", + "link": "https://nodejs.org/en/blog/migrations" } } }