Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/site/pages/en/blog/migrations/v12-to-v14.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
30 changes: 4 additions & 26 deletions apps/site/pages/en/blog/migrations/v14-to-v16.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);

Expand All @@ -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);

Expand Down
14 changes: 7 additions & 7 deletions apps/site/pages/en/blog/migrations/v22-to-v24.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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).

Expand Down Expand Up @@ -101,15 +101,15 @@ 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).

```bash
npx codemod run @nodejs/util-log-to-console-log
```

### Example:
#### Example:

```js displayName="Before"
const util = require('node:util');
Expand Down Expand Up @@ -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).

Expand Down Expand Up @@ -221,7 +221,7 @@ crypto.generateKeyPair(
```

```js displayName="After"
const crypto = require('crypto');
const crypto = require('node:crypto');

crypto.generateKeyPair(
'rsa-pss',
Expand Down
10 changes: 5 additions & 5 deletions apps/site/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Loading