Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5d7b7d7
content(`userland-migration`): make up to date
AugustinMauroy Jul 30, 2025
d398f90
Update introduction.md
AugustinMauroy Aug 13, 2025
154245b
update
AugustinMauroy Aug 13, 2025
010996b
Update navigation.json
AugustinMauroy Aug 13, 2025
99f368e
Update
AugustinMauroy Aug 24, 2025
17bcae9
use correct casing
AugustinMauroy Aug 26, 2025
81ee06b
update
AugustinMauroy Sep 22, 2025
6d86268
update after meeting
AugustinMauroy Sep 26, 2025
a009faf
fix link
AugustinMauroy Sep 26, 2025
c7d66ab
feat(mdx): add alertBox
AugustinMauroy Sep 26, 2025
464acd9
fix
AugustinMauroy Sep 26, 2025
9310143
update
AugustinMauroy Oct 10, 2025
ddc4cdb
update + improve
AugustinMauroy Oct 10, 2025
2832256
Merge branch 'main' into content(`userland-migration`)
AugustinMauroy Oct 13, 2025
608dae0
make date up to date
AugustinMauroy Oct 13, 2025
42af1f4
Delete next.mdx.use.mjs
AugustinMauroy Oct 13, 2025
23e7e1d
apply sugession
AugustinMauroy Oct 18, 2025
8b4b976
use sha for image
AugustinMauroy Oct 18, 2025
885d7d9
use alertBox as info
AugustinMauroy Oct 18, 2025
89ef3ba
Merge branch 'main' into content(`userland-migration`)
AugustinMauroy Oct 27, 2025
fe3f9d5
update
AugustinMauroy Oct 27, 2025
dd7c13e
bump date
AugustinMauroy Oct 27, 2025
38db89a
change date to order by version
AugustinMauroy Oct 27, 2025
b1a5c4a
i'm dum
AugustinMauroy Oct 27, 2025
1ea9a92
Update apps/site/pages/en/blog/migrations/v22-to-v24.mdx
AugustinMauroy Oct 28, 2025
daf646a
Update navigation.json
AugustinMauroy Oct 29, 2025
1923ff2
fix grammar
AugustinMauroy Oct 29, 2025
47f8b45
Merge branch 'main' into content(`userland-migration`)
AugustinMauroy Oct 29, 2025
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
1 change: 1 addition & 0 deletions apps/site/layouts/Blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const BlogLayout: FC = () => {
'announcements',
'release',
'vulnerability',
'migrations',
'events',
])}
/>
Expand Down
3 changes: 3 additions & 0 deletions apps/site/mdx/components.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

import AlertBox from '@node-core/ui-components/Common/AlertBox';
import BadgeGroup from '@node-core/ui-components/Common/BadgeGroup';
import Blockquote from '@node-core/ui-components/Common/Blockquote';
import MDXCodeTabs from '@node-core/ui-components/MDX/CodeTabs';
Expand Down Expand Up @@ -54,6 +55,8 @@ export default {
blockquote: Blockquote,
pre: MDXCodeBox,
img: MDXImage,
// Renders a CSS-enhanced Alert Box
AlertBox,
// Renders MDX CodeTabs
CodeTabs: MDXCodeTabs,
// Renders Tooltips
Expand Down
38 changes: 29 additions & 9 deletions apps/site/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@
"securityBestPractices": {
"link": "/learn/getting-started/security-best-practices",
"label": "components.navigation.learn.gettingStarted.links.securityBestPractices"
},
"userlandMigrations": {
"link": "/learn/getting-started/userland-migrations",
"label": "components.navigation.learn.gettingStarted.links.userlandMigrations"
}
}
},
Expand Down Expand Up @@ -336,15 +340,6 @@
}
}
},
"migrations": {
"label": "components.navigation.learn.migrations.links.migrations",
"items": {
"introduction": {
"link": "/learn/migrations/introduction",
"label": "components.navigation.learn.migrations.links.introduction"
}
}
},
"modules": {
"label": "components.navigation.learn.modules.links.modules",
"items": {
Expand Down Expand Up @@ -419,6 +414,31 @@
"label": "components.navigation.learn.testRunner.links.collectingCodeCoverage"
}
}
},
"userland-migrations": {
"label": "components.navigation.learn.userland-migrations.links.userland-migrations",
"items": {
"introduction": {
"link": "/learn/userland-migrations/introduction",
"label": "components.navigation.learn.userland-migrations.links.introduction"
},
"ecosystem": {
"link": "/learn/userland-migrations/ecosystem",
"label": "components.navigation.learn.userland-migrations.links.ecosystem"
},
"v22-to-v24": {
"link": "/learn/userland-migrations/v22-to-v24",
"label": "components.navigation.learn.userland-migrations.links.v22-to-v24"
},
"v20-to-v22": {
"link": "/learn/userland-migrations/v20-to-v22",
"label": "components.navigation.learn.userland-migrations.links.v20-to-v22"
},
"v14-to-v16": {
"link": "/learn/userland-migrations/v14-to-v16",
"label": "components.navigation.learn.userland-migrations.links.v14-to-v16"
}
}
}
}
}
Expand Down
43 changes: 43 additions & 0 deletions apps/site/next.mdx.use.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

import BadgeGroup from '@node-core/ui-components/Common/BadgeGroup';

import Button from './components/Common/Button';
import LinkWithArrow from './components/Common/LinkWithArrow';
import EOLAlertBox from './components/EOL/EOLAlert';
import EOLReleaseTable from './components/EOL/EOLReleaseTable';
import Link from './components/Link';
import UpcomingMeetings from './components/MDX/Calendar/UpcomingMeetings';
import PreviousReleasesTable from './components/Releases/PreviousReleasesTable';
import WithBadgeGroup from './components/withBadgeGroup';
import WithBanner from './components/withBanner';
import WithNodeRelease from './components/withNodeRelease';

/**
* A full list of React Components that we want to pass through to MDX
*
* @satisfies {import('mdx/types').MDXComponents}
*/
export const mdxComponents = {
PreviousReleasesTable,
// HOC for getting Node.js Release Metadata
WithNodeRelease,
// HOC for providing Banner Data
WithBanner,
// HOC for providing Badge Data
WithBadgeGroup,
// Standalone Badge Group
BadgeGroup,
// Renders an container for Upcoming Node.js Meetings
UpcomingMeetings,
// Renders an EOL alert
EOLAlertBox,
// Renders the EOL Table
EOLReleaseTable,
// Renders a Button Component for `button` tags
Button,
// Regular links (without arrow)
Link,
// Links with External Arrow
LinkWithArrow,
};
56 changes: 56 additions & 0 deletions apps/site/pages/en/blog/migrations/v12-to-v14.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
date: '2025-10-10T12:00:00.000Z'
category: migrations
title: Node.js v12 to v14
layout: blog-post
author: AugustinMauroy
---

# Node.js v12 to v14

<AlertBox level="warning" title="!">
This article cover a part of the migration from Node.js v12 to v14. The
userland migrations team is working on more codemods to help you with the
migration.
</AlertBox>

This page provides a list of codemods to help you migrate your code from Node.js v12 to v14.

## `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`:

- [DEP0026](https://nodejs.org/api/deprecations.html#DEP0026): `util.print` ➜ `console.log`
- [DEP0027](https://nodejs.org/api/deprecations.html#DEP0027): `util.puts` ➜ `console.log`
- [DEP0028](https://nodejs.org/api/deprecations.html#DEP0028): `util.debug` ➜ `console.error`
- [DEP0029](https://nodejs.org/api/deprecations.html#DEP0029): `util.error` ➜ `console.error`

```bash
npx codemod run @nodejs/create-require-from-path
```

### Example:

```js displayName="Before"
const util = require('node:util');

util.print('Hello world');
util.puts('Hello world');
util.debug('Hello world');
util.error('Hello world');
```

```js displayName="After"
console.log('Hello world');
console.log('Hello world');
console.error('Hello world');
console.error('Hello world');
```

### Source Code

The source code for this codemod can be found in the [util-print-to-console-log directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/util-print-to-console-log).

### Registry Link

You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/util-print-to-console-log).
181 changes: 181 additions & 0 deletions apps/site/pages/en/blog/migrations/v14-to-v16.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
---
date: '2025-10-10T12:00:00.000Z'
category: migrations
title: Node.js v14 to v16
layout: blog-post
author: AugustinMauroy
---

# Node.js v14 to v16

<AlertBox level="warning" title="!">
This article cover a part of the migration from Node.js v14 to v16. The
userland migrations team is working on more codemods to help you with the
migration.
</AlertBox>

This page provides a list of codemods to help you migrate your code from Node.js v14 to v16.

## `create-require-from-path`

Node.js v16 replaced the [`createRequireFromPath`](https://nodejs.org/api/module.html#module_module_createrequirefrompath) function, deprecated in [DEP0148](https://nodejs.org/api/deprecations.html#DEP0148), with the modern [`createRequire`](https://nodejs.org/api/module.html#module_module_createrequire) function. This codemod replaces calls of the deprecated function with the modern alternative mentioned.

```bash
npx codemod run @nodejs/create-require-from-path
```

### Example:

```js displayName="Before"
import { createRequireFromPath } from 'node:module';

const requireFromPath = createRequireFromPath('/path/to/module');
const myModule = requireFromPath('./myModule.cjs');
```

```js displayName="After"
import { createRequire } from 'node:module';

const require = createRequire('/path/to/module');
const myModule = require('./myModule.cjs');
```

### Source Code

The source code for this codemod can be found in the [create-require-from-path directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/create-require-from-path).

### Registry Link

You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/create-require-from-path).

## `process-main-module`

The `process.mainModule` property was deprecated in favor of `require.main`. This codemod will help you replace the old `process.mainModule` usage with the new `require.main` usage.

So the codemod handle [DEP0138](https://nodejs.org/api/deprecations.html#DEP0138).

```bash
npx codemod run @nodejs/process-main-module
```

### Example:

```js displayName="Before"
if (process.mainModule === 'mod.js') {
// cli thing
} else {
// module thing
}
```

```js displayName="After"
if (require.main === 'mod.js') {
// cli thing
} else {
// module thing
}
```

### Source Code

The source code for this codemod can be found in the [process-main-module directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/process-main-module).

### Registry Link

You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/process-main-module).

## `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.

```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.

so this codemod handle [DEP0147](https://nodejs.org/api/deprecations.html#DEP0147).

```bash
npx codemod run @nodejs/rmdir
```

### Example:

```js displayName="Before"
// Using fs.rmdir with the recursive option
fs.rmdir(path, { recursive: true }, callback);

// Using fs.rmdirSync with the recursive option
fs.rmdirSync(path, { recursive: true });

// Using fs.promises.rmdir with the recursive option
fs.promises.rmdir(path, { recursive: true });
```

```js displayName="After"
// Using fs.rm with recursive and force options
fs.rm(path, { recursive: true, force: true }, callback);

// Using fs.rmSync with recursive and force options
fs.rmSync(path, { recursive: true, force: true });

// Using fs.promises.rm with recursive and force options
fs.promises.rm(path, { recursive: true, force: true });
```

### Source Code

The source code for this codemod can be found in the [rmdir directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/rmdir).

### Registry Link

You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/rmdir).

## `tmpDir-to-tmpdir`

The `tmpDir` function was renamed to `tmpdir` in Node.js v16. This codemod will help you replace all instances of `tmpDir` with `tmpdir`.

So the codemod handles [DEP0022](https://nodejs.org/docs/latest/api/deprecations.html#dep0022-ostmpdir).

```bash
npx codemod run @nodejs/tmpDir-to-tmpdir
```

### Example:

```js displayName="Before"
import { tmpDir } from 'node:os';

const foo = tmpDir();
```

```js displayName="After"
import { tmpdir } from 'node:os';

const foo = tmpdir();
```

### Source Code

The source code for this codemod can be found in the [tmpdir-to-tmpdir directory](https://github.com/nodejs/userland-migrations/tree/main/recipes/tmpdir-to-tmpdir).

### Registry Link

You can find this codemod in the [Codemod Registry](https://app.codemod.com/registry/@nodejs/tmpDir-to-tmpdir).
Loading
Loading