From 5d7b7d73c5bfd39c64f81c8317caa38c8b3e837b Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Wed, 30 Jul 2025 18:17:53 +0200 Subject: [PATCH 01/11] content(`userland-migration`): make up to date --- apps/site/navigation.json | 20 ++++- .../pages/en/learn/migrations/introduction.md | 28 ------- .../en/learn/userland-migrations/ecosystem.md | 25 ++++++ .../learn/userland-migrations/introduction.md | 74 +++++++++++++++++ .../learn/userland-migrations/v14-to-v16.md | 79 +++++++++++++++++++ .../learn/userland-migrations/v20-to-v22.md | 29 +++++++ packages/i18n/src/locales/en.json | 9 ++- 7 files changed, 229 insertions(+), 35 deletions(-) delete mode 100644 apps/site/pages/en/learn/migrations/introduction.md create mode 100644 apps/site/pages/en/learn/userland-migrations/ecosystem.md create mode 100644 apps/site/pages/en/learn/userland-migrations/introduction.md create mode 100644 apps/site/pages/en/learn/userland-migrations/v14-to-v16.md create mode 100644 apps/site/pages/en/learn/userland-migrations/v20-to-v22.md diff --git a/apps/site/navigation.json b/apps/site/navigation.json index 025763c89aa89..7adc547086d0d 100644 --- a/apps/site/navigation.json +++ b/apps/site/navigation.json @@ -328,12 +328,24 @@ } } }, - "migrations": { - "label": "components.navigation.learn.migrations.links.migrations", + "userland-migrations": { + "label": "components.navigation.learn.userland-migrations.links.userland-migrations", "items": { "introduction": { - "link": "/learn/migrations/introduction", - "label": "components.navigation.learn.migrations.links.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" + }, + "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" } } }, diff --git a/apps/site/pages/en/learn/migrations/introduction.md b/apps/site/pages/en/learn/migrations/introduction.md deleted file mode 100644 index 40c45a25259f5..0000000000000 --- a/apps/site/pages/en/learn/migrations/introduction.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: Userland Migrations -layout: learn -authors: JakobJingleheimer ---- - -# Userland Migrations - -Node.js provides migrations for "userland" (what you write vs node's own) source-code to facilitate adoption of new features and upgrading source-code affected by breaking changes. These are done in collaboration with [`codemod`](https://www.codemod.com), who also work with other major projects like Next.js, React, and Tailwind. Node.js's migrations live in the [`nodejs/userland-migrations`](https://github.com/nodejs/userland-migrations) repository and are overseen by the [`@nodejs/userland-migrations`](https://github.com/orgs/nodejs/teams/userland-migrations) team. - -Official migrations are published under the `@nodejs` namespace within the [codemod registry](https://codemod.com/registry?framework=node.js). These have been reviewed and/or authored by Node.js members. There are also unofficial migrations available which have not been reviewed by Node.js. - -A migration alters a project's source-code to apply a new design pattern, like: - -```console -cd path/to/your/project -npx codemod@latest @nodejs/correct-ts-specifiers -``` - -The cited migration transforms legacy typescript imports to standards-compliant specifiers like: - -```ts displayName="before" -import Foo from './foo'; -``` - -```ts displayName="after" -import type Foo from './foo/index.ts'; -``` diff --git a/apps/site/pages/en/learn/userland-migrations/ecosystem.md b/apps/site/pages/en/learn/userland-migrations/ecosystem.md new file mode 100644 index 0000000000000..07849396787e3 --- /dev/null +++ b/apps/site/pages/en/learn/userland-migrations/ecosystem.md @@ -0,0 +1,25 @@ +--- +title: Ecosystem to Node.js +layout: learn +authors: AugustinMauroy +--- + +# Ecosystem to Node.js + +Sometimes the ecosystem creates awesome tools or libraries for node.js, but a native alternative is present in Node.js. So, this page shows you codemod that handle this case. + +## `correct-ts-specifiers` + +When you want to [run typescript natively in Node.js](/learn/typescript/run-natively), you need to have a correct "specifiers" in your [imports statements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import). + +To run this codemdod, you have to use this command: + +```bash +npx codemod@latest run correct-ts-specifiers +``` + +> **Note:** This codemod use "legacy" codemod CLI, if you wan to undersant more about it, you can read the [new codemod CLI announcement](https://codemod.com/blog/new-codemod-cli). + +## Feedback + +If you have any tools that you would like to be handle by userland-migrations, please open an issue on the [Node.js Userland Migrations repository](https://github.com/nodejs/userland-migrations/issues). diff --git a/apps/site/pages/en/learn/userland-migrations/introduction.md b/apps/site/pages/en/learn/userland-migrations/introduction.md new file mode 100644 index 0000000000000..a254ae6fbb835 --- /dev/null +++ b/apps/site/pages/en/learn/userland-migrations/introduction.md @@ -0,0 +1,74 @@ +--- +title: Userland Migrations +layout: learn +authors: JakobJingleheimer, AugustinMauroy +--- + +![Node.js Userland Migrations](https://raw.githubusercontent.com/nodejs/userland-migrations/main/.github/assets/Userland-Migration-Tagline.png) + +# Userland Migrations + +Node.js provides migrations for "userland" (what you write vs node's own) source-code to facilitate adoption of new features and upgrading source-code affected by breaking changes. These are done in collaboration with [`codemod`](https://docs.codemod.com/introduction), who also work with other major projects like Next.js, React, and Tailwind. Node.js's migrations live in the [`nodejs/userland-migrations`](https://github.com/nodejs/userland-migrations) repository and are overseen by the `@nodejs/userland-migrations` team. + + + +Official migrations are published under the `@nodejs` namespace within the [codemod registry](https://codemod.link/nodejs-official). These have been reviewed and/or authored by Node.js members. There are also unofficial migrations available which have not been reviewed by Node.js. + +## Our goal + +First our goal is to help you to migrate your codebase to the latest Node.js version. We want to make it easier for you to adopt new features, deprecations, and breaking changes. In summary, we want to help you to migrate your codebase to the latest Node.js version. + +Second, we want to help you to adopt native Node.js features that are already available in the ecosystem. For example, if you are using a library that provides a feature that is already available in Node.js, we want to help you to migrate to the native Node.js feature. + +## How to use a Codemod + +To use a codemod, you can run the following command in your terminal: + +```bash displayName="npm" +npx codemod@next +``` + +```bash displayName="yarn" +yarn dlx codemod@next +``` + +```bash displayName="pnpm" +pnpx codemod@next +``` + +Replace `` with the name of the codemod you want to run. For example, if you want to run the `@nodejs/import-assertions-to-attributes` codemod on your project, you would run: + +```bash displayName="npm" +npx codemod@next @nodejs/import-assertions-to-attributes +``` + +```bash displayName="yarn" +yarn dlx codemod@next @nodejs/import-assertions-to-attributes +``` + +```bash displayName="pnpm" +pnpx codemod@next @nodejs/import-assertions-to-attributes +``` + +## Good Practices + +- **Run migrations in a separate branch**: If you are using a version control system like Git, it is a good practice to run migrations in a separate branch. This allows you to review the changes before merging them into your main branch. +- **Review changes**: After running a migration, review the changes made to your codebase. Ensure that the migration has not introduced any unintended side effects or issues. +- **Test your code**: After running a migration, it is important to test your code to ensure that everything is working as expected. Run your test suite and check for any errors or failures + +## Feedback + +If you have any feedback or suggestions for improvements, please open an issue on the [Node.js Userland Migrations repository](https://github.com/nodejs/userland-migrations/issues). + +## Follow the Userland Migrations Progression + +You can follow the progress of userland migrations on our [GitHub project board](https://github.com/orgs/nodejs/projects/13/views/1). + +This board tracks: + +- Codemod kind (deprecation, breaking change, ecosystem) +- Node.js version +- Status (backlog, todo, in progress, done, not planned) _If you want to contribute, please check the "todo" column_ diff --git a/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md b/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md new file mode 100644 index 0000000000000..773a0f4353d1f --- /dev/null +++ b/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md @@ -0,0 +1,79 @@ +--- +title: Nodejs v14 to v16 +layout: learn +authors: AugustinMauroy +--- + +# Nodejs v14 to v16 + +This page provides a list of codemods to help you migrate your code from Node.js v14 to v16. + +## `create-require-from-path` + +In Node.js v16, the `createRequire` function was introduced to allow you to create a `require` function that can be used in ESM modules. This codemod will help you replace the old `createRequireFromPath` function with the new `createRequire` function. + +So this codemod handle [DEP0130](https://nodejs.org/api/deprecations.html#DEP0130). + +```bash +npx codemod@latest @nodejs/create-require-from-path +``` + +Example: + +**Before:** + +```js +import { createRequireFromPath } from 'node:module'; + +// Using createRequireFromPath +const requireFromPath = createRequireFromPath('/path/to/module'); +const myModule = requireFromPath('./myModule.cjs'); +``` + +**After:** + +```js +import { createRequire } from 'node:module'; + +// Using createRequire with a specific path +const require = createRequire('/path/to/module'); +const myModule = require('./myModule.cjs'); +``` + +## `rmdir` + +In Node.js v16, 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@latest @nodejs/rmdir +``` + +Example: + +**Before:** + +```js +// 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 }); +``` + +**After:** + +```js +// 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 }); +``` diff --git a/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md b/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md new file mode 100644 index 0000000000000..d95d0b8d04edc --- /dev/null +++ b/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md @@ -0,0 +1,29 @@ +--- +title: Nodejs v20 to v22 +layout: learn +authors: AugustinMauroy +--- + +# Nodejs v20 to v22 + +This page provides a list of codemods to help you migrate your code from Node.js v20 to v22. + +## `import-assertions-to-attributes` + +During the process of TC39 standardization, the `import assert` feature was introduced to allow importing [JSON modules](https://tc39.es/proposal-json-modules/) but during the during the transition to stage 4, the `assert` keyword was removed and replaced with an `with` attribute on the `import` statement. + +So in [node.js v22](https://nodejs.org/fr/blog/release/v22.0.0#other-notable-changes), the `import assert` feature was removed and you need to use the `with` attribute instead. + +Also note that the `with` keyword as been introduce in [node.js v18.20](https://nodejs.org/fr/blog/release/v18.20.0#added-support-for-import-attributes) but it was not mandatory until v22. + +```bash +npx codemod@latest @nodejs/import-assertions-to-attributes +``` + +Example: + +```js +import jsonData from './data.json' assert { type: 'json' }; +// becomes +import jsonData from './data.json' with { type: 'json' }; +``` diff --git a/packages/i18n/src/locales/en.json b/packages/i18n/src/locales/en.json index 18faf3a92c9af..848c117489e5f 100644 --- a/packages/i18n/src/locales/en.json +++ b/packages/i18n/src/locales/en.json @@ -98,10 +98,13 @@ "acceptInputFromTheCommandLineInNodejs": "Accept input from the command line in Node.js" } }, - "migrations": { + "userland-migrations": { "links": { - "migrations": "Userland Migrations", - "introduction": "Introduction to Userland Migrations" + "userland-migrations": "Userland Migrations", + "introduction": "Introduction to Userland Migrations", + "ecosystem": "Ecosystem to Node.js", + "v20-to-v22": "Node.js v20 to v22", + "v14-to-v16": "Node.js v14 to v16" } }, "modules": { From d398f90eef7b1334af0d9f918f1855efa28f82e0 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Wed, 13 Aug 2025 12:08:34 +0200 Subject: [PATCH 02/11] Update introduction.md --- .../learn/userland-migrations/introduction.md | 34 ++++--------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/apps/site/pages/en/learn/userland-migrations/introduction.md b/apps/site/pages/en/learn/userland-migrations/introduction.md index a254ae6fbb835..26f5fd01a2fac 100644 --- a/apps/site/pages/en/learn/userland-migrations/introduction.md +++ b/apps/site/pages/en/learn/userland-migrations/introduction.md @@ -10,54 +10,32 @@ authors: JakobJingleheimer, AugustinMauroy Node.js provides migrations for "userland" (what you write vs node's own) source-code to facilitate adoption of new features and upgrading source-code affected by breaking changes. These are done in collaboration with [`codemod`](https://docs.codemod.com/introduction), who also work with other major projects like Next.js, React, and Tailwind. Node.js's migrations live in the [`nodejs/userland-migrations`](https://github.com/nodejs/userland-migrations) repository and are overseen by the `@nodejs/userland-migrations` team. - +Official migrations are published under the `@nodejs` scope within the [codemod registry](https://codemod.link/nodejs-official). These have been reviewed and/or authored by Node.js members. -Official migrations are published under the `@nodejs` namespace within the [codemod registry](https://codemod.link/nodejs-official). These have been reviewed and/or authored by Node.js members. There are also unofficial migrations available which have not been reviewed by Node.js. +## Goal -## Our goal - -First our goal is to help you to migrate your codebase to the latest Node.js version. We want to make it easier for you to adopt new features, deprecations, and breaking changes. In summary, we want to help you to migrate your codebase to the latest Node.js version. - -Second, we want to help you to adopt native Node.js features that are already available in the ecosystem. For example, if you are using a library that provides a feature that is already available in Node.js, we want to help you to migrate to the native Node.js feature. +The Node.js Userland Migrations team seeks to help developers migrate their codebases to the latest Node.js versions, making it easier to handle deprecations, new features, and breaking changes. ## How to use a Codemod To use a codemod, you can run the following command in your terminal: -```bash displayName="npm" +```bash npx codemod@next ``` -```bash displayName="yarn" -yarn dlx codemod@next -``` - -```bash displayName="pnpm" -pnpx codemod@next -``` - Replace `` with the name of the codemod you want to run. For example, if you want to run the `@nodejs/import-assertions-to-attributes` codemod on your project, you would run: -```bash displayName="npm" +```bash npx codemod@next @nodejs/import-assertions-to-attributes ``` -```bash displayName="yarn" -yarn dlx codemod@next @nodejs/import-assertions-to-attributes -``` - -```bash displayName="pnpm" -pnpx codemod@next @nodejs/import-assertions-to-attributes -``` - ## Good Practices - **Run migrations in a separate branch**: If you are using a version control system like Git, it is a good practice to run migrations in a separate branch. This allows you to review the changes before merging them into your main branch. - **Review changes**: After running a migration, review the changes made to your codebase. Ensure that the migration has not introduced any unintended side effects or issues. - **Test your code**: After running a migration, it is important to test your code to ensure that everything is working as expected. Run your test suite and check for any errors or failures +- **Format and or lint your code**: After running a migration, it is a good practice to format and lint your code. This ensures that your code follows the project's coding standards and is easier to read and maintain. ## Feedback From 154245b5d44dcd8b6c1a9a52f31a4c1cb8704253 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Wed, 13 Aug 2025 12:24:20 +0200 Subject: [PATCH 03/11] update --- .../en/learn/userland-migrations/ecosystem.md | 6 +- .../learn/userland-migrations/introduction.md | 2 +- .../learn/userland-migrations/v14-to-v16.md | 70 +++++++++++++++++-- .../learn/userland-migrations/v20-to-v22.md | 6 +- 4 files changed, 71 insertions(+), 13 deletions(-) diff --git a/apps/site/pages/en/learn/userland-migrations/ecosystem.md b/apps/site/pages/en/learn/userland-migrations/ecosystem.md index 07849396787e3..3579ef5179f20 100644 --- a/apps/site/pages/en/learn/userland-migrations/ecosystem.md +++ b/apps/site/pages/en/learn/userland-migrations/ecosystem.md @@ -12,14 +12,12 @@ Sometimes the ecosystem creates awesome tools or libraries for node.js, but a na When you want to [run typescript natively in Node.js](/learn/typescript/run-natively), you need to have a correct "specifiers" in your [imports statements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import). -To run this codemdod, you have to use this command: +To run this codemod, you have to use this command: ```bash -npx codemod@latest run correct-ts-specifiers +npx codemod run @nodejs/correct-ts-specifiers ``` -> **Note:** This codemod use "legacy" codemod CLI, if you wan to undersant more about it, you can read the [new codemod CLI announcement](https://codemod.com/blog/new-codemod-cli). - ## Feedback If you have any tools that you would like to be handle by userland-migrations, please open an issue on the [Node.js Userland Migrations repository](https://github.com/nodejs/userland-migrations/issues). diff --git a/apps/site/pages/en/learn/userland-migrations/introduction.md b/apps/site/pages/en/learn/userland-migrations/introduction.md index 26f5fd01a2fac..23b2f9c93e6bf 100644 --- a/apps/site/pages/en/learn/userland-migrations/introduction.md +++ b/apps/site/pages/en/learn/userland-migrations/introduction.md @@ -8,7 +8,7 @@ authors: JakobJingleheimer, AugustinMauroy # Userland Migrations -Node.js provides migrations for "userland" (what you write vs node's own) source-code to facilitate adoption of new features and upgrading source-code affected by breaking changes. These are done in collaboration with [`codemod`](https://docs.codemod.com/introduction), who also work with other major projects like Next.js, React, and Tailwind. Node.js's migrations live in the [`nodejs/userland-migrations`](https://github.com/nodejs/userland-migrations) repository and are overseen by the `@nodejs/userland-migrations` team. +Node.js offers migrations for "userland" code (anything outside the node executable) to help adopt new features and handle breaking changes. These are built in collaboration with Codemod, a platform focused on making it easy to build, share, and run codemods. Official migrations are published under the `@nodejs` scope within the [codemod registry](https://codemod.link/nodejs-official). These have been reviewed and/or authored by Node.js members. diff --git a/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md b/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md index 773a0f4353d1f..5b9ec005eed92 100644 --- a/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md +++ b/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md @@ -1,10 +1,10 @@ --- -title: Nodejs v14 to v16 +title: Node.js v14 to v16 layout: learn authors: AugustinMauroy --- -# Nodejs v14 to v16 +# Node.js v14 to v16 This page provides a list of codemods to help you migrate your code from Node.js v14 to v16. @@ -15,7 +15,7 @@ In Node.js v16, the `createRequire` function was introduced to allow you to crea So this codemod handle [DEP0130](https://nodejs.org/api/deprecations.html#DEP0130). ```bash -npx codemod@latest @nodejs/create-require-from-path +npx codemod run @nodejs/create-require-from-path ``` Example: @@ -40,14 +40,46 @@ const require = createRequire('/path/to/module'); const myModule = require('./myModule.cjs'); ``` +## `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: + +**Before:** + +```js +if (process.mainModule === 'mod.js') { + // cli thing +} else { + // module thing +} +``` + +**After:** + +```js +if (require.main === 'mod.js') { + // cli thing +} else { + // module thing +} +``` + ## `rmdir` -In Node.js v16, 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. +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@latest @nodejs/rmdir +npx codemod run @nodejs/rmdir ``` Example: @@ -77,3 +109,31 @@ fs.rmSync(path, { recursive: true, force: true }); // Using fs.promises.rm with recursive and force options fs.promises.rm(path, { recursive: true, force: true }); ``` + +## `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: + +**Before:** + +```js +import { tmpDir } from 'node:os'; + +const foo = tmpDir(); +``` + +**After:** + +```js +import { tmpdir } from 'node:os'; + +const foo = tmpdir(); +``` diff --git a/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md b/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md index d95d0b8d04edc..7e5fe2d0942c2 100644 --- a/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md +++ b/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md @@ -1,10 +1,10 @@ --- -title: Nodejs v20 to v22 +title: Node.js v20 to v22 layout: learn authors: AugustinMauroy --- -# Nodejs v20 to v22 +# Node.js v20 to v22 This page provides a list of codemods to help you migrate your code from Node.js v20 to v22. @@ -17,7 +17,7 @@ So in [node.js v22](https://nodejs.org/fr/blog/release/v22.0.0#other-notable-cha Also note that the `with` keyword as been introduce in [node.js v18.20](https://nodejs.org/fr/blog/release/v18.20.0#added-support-for-import-attributes) but it was not mandatory until v22. ```bash -npx codemod@latest @nodejs/import-assertions-to-attributes +npx codemod run @nodejs/import-assertions-to-attributes ``` Example: From 010996b9b4859a8f0fc763e5b34c986e254c6862 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Wed, 13 Aug 2025 12:43:16 +0200 Subject: [PATCH 04/11] Update navigation.json --- apps/site/navigation.json | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/apps/site/navigation.json b/apps/site/navigation.json index 7adc547086d0d..e22216b7997da 100644 --- a/apps/site/navigation.json +++ b/apps/site/navigation.json @@ -328,27 +328,6 @@ } } }, - "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" - }, - "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" - } - } - }, "modules": { "label": "components.navigation.learn.modules.links.modules", "items": { @@ -423,6 +402,27 @@ "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" + }, + "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" + } + } } } } From 99f368e7b73f08ab291ef4e39d59de92c5b18552 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Sun, 24 Aug 2025 12:05:34 +0200 Subject: [PATCH 05/11] Update --- apps/site/navigation.json | 4 ++ .../learn/userland-migrations/introduction.md | 4 +- .../learn/userland-migrations/v14-to-v16.md | 40 +++++----------- .../learn/userland-migrations/v20-to-v22.md | 8 ++-- .../learn/userland-migrations/v22-to-v24.md | 47 +++++++++++++++++++ packages/i18n/src/locales/en.json | 1 + 6 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 apps/site/pages/en/learn/userland-migrations/v22-to-v24.md diff --git a/apps/site/navigation.json b/apps/site/navigation.json index e22216b7997da..9dfce2b381116 100644 --- a/apps/site/navigation.json +++ b/apps/site/navigation.json @@ -414,6 +414,10 @@ "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" diff --git a/apps/site/pages/en/learn/userland-migrations/introduction.md b/apps/site/pages/en/learn/userland-migrations/introduction.md index 23b2f9c93e6bf..9a49027c8aabd 100644 --- a/apps/site/pages/en/learn/userland-migrations/introduction.md +++ b/apps/site/pages/en/learn/userland-migrations/introduction.md @@ -21,13 +21,13 @@ The Node.js Userland Migrations team seeks to help developers migrate their code To use a codemod, you can run the following command in your terminal: ```bash -npx codemod@next +npx codemod ``` Replace `` with the name of the codemod you want to run. For example, if you want to run the `@nodejs/import-assertions-to-attributes` codemod on your project, you would run: ```bash -npx codemod@next @nodejs/import-assertions-to-attributes +npx codemod @nodejs/import-assertions-to-attributes ``` ## Good Practices diff --git a/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md b/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md index 5b9ec005eed92..bba8e4a06bb3d 100644 --- a/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md +++ b/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md @@ -18,11 +18,9 @@ So this codemod handle [DEP0130](https://nodejs.org/api/deprecations.html#DEP013 npx codemod run @nodejs/create-require-from-path ``` -Example: +### Example: -**Before:** - -```js +```js displayName="Before" import { createRequireFromPath } from 'node:module'; // Using createRequireFromPath @@ -30,9 +28,7 @@ const requireFromPath = createRequireFromPath('/path/to/module'); const myModule = requireFromPath('./myModule.cjs'); ``` -**After:** - -```js +```js displayName="After" import { createRequire } from 'node:module'; // Using createRequire with a specific path @@ -50,11 +46,9 @@ So the codemod handle [DEP0138](https://nodejs.org/api/deprecations.html#DEP0138 npx codemod run @nodejs/process-main-module ``` -Example: +### Example: -**Before:** - -```js +```js displayName="Before" if (process.mainModule === 'mod.js') { // cli thing } else { @@ -62,9 +56,7 @@ if (process.mainModule === 'mod.js') { } ``` -**After:** - -```js +```js displayName="After" if (require.main === 'mod.js') { // cli thing } else { @@ -82,11 +74,9 @@ so this codemod handle [DEP0147](https://nodejs.org/api/deprecations.html#DEP014 npx codemod run @nodejs/rmdir ``` -Example: +### Example: -**Before:** - -```js +```js displayName="Before" // Using fs.rmdir with the recursive option fs.rmdir(path, { recursive: true }, callback); @@ -97,9 +87,7 @@ fs.rmdirSync(path, { recursive: true }); fs.promises.rmdir(path, { recursive: true }); ``` -**After:** - -```js +```js displayName="After" // Using fs.rm with recursive and force options fs.rm(path, { recursive: true, force: true }, callback); @@ -120,19 +108,15 @@ So the codemod handles [DEP0022](https://nodejs.org/docs/latest/api/deprecations npx codemod run @nodejs/tmpDir-to-tmpdir ``` -Example: +### Example: -**Before:** - -```js +```js displayName="Before" import { tmpDir } from 'node:os'; const foo = tmpDir(); ``` -**After:** - -```js +```js displayName="After" import { tmpdir } from 'node:os'; const foo = tmpdir(); diff --git a/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md b/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md index 7e5fe2d0942c2..efd3e7bbee4b3 100644 --- a/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md +++ b/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md @@ -20,10 +20,12 @@ Also note that the `with` keyword as been introduce in [node.js v18.20](https:// npx codemod run @nodejs/import-assertions-to-attributes ``` -Example: +### Example: -```js +```js displayName="Before" import jsonData from './data.json' assert { type: 'json' }; -// becomes +``` + +```js displayName="After" import jsonData from './data.json' with { type: 'json' }; ``` diff --git a/apps/site/pages/en/learn/userland-migrations/v22-to-v24.md b/apps/site/pages/en/learn/userland-migrations/v22-to-v24.md new file mode 100644 index 0000000000000..b695310fbed4d --- /dev/null +++ b/apps/site/pages/en/learn/userland-migrations/v22-to-v24.md @@ -0,0 +1,47 @@ +--- +title: Node.js v22 to v24 +layout: learn +authors: AugustinMauroy +--- + +# Node.js v22 to v24 + +This page provides a list of codemods to help you migrate your code from Node.js v22 to v24. + +## `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. + +So this codemod handle [DEP0176](https://nodejs.org/api/deprecations.html#DEP0176). + +```js displayName="Before" +const fs = require('node:fs'); + +fs.access('/path/to/file', fs.F_OK, callback); +fs.access('/path/to/file', fs.R_OK | fs.W_OK, callback); +``` + +```js displayName="After" +const fs = require('node:fs'); + +fs.access('/path/to/file', fs.constants.F_OK, callback); +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 + +So this codemod handle [DEP0059](https://nodejs.org/api/deprecations.html#DEP0059). + +### Example: + +```js displayName="Before" +const util = require('node:util'); + +util.log('Hello world'); +``` + +```js displayName="After" +console.log(new Date().toLocaleString(), 'Hello world'); +``` diff --git a/packages/i18n/src/locales/en.json b/packages/i18n/src/locales/en.json index 848c117489e5f..a0e3acda38b6a 100644 --- a/packages/i18n/src/locales/en.json +++ b/packages/i18n/src/locales/en.json @@ -103,6 +103,7 @@ "userland-migrations": "Userland Migrations", "introduction": "Introduction to Userland Migrations", "ecosystem": "Ecosystem to Node.js", + "v22-to-v24": "Node.js v22 to v24", "v20-to-v22": "Node.js v20 to v22", "v14-to-v16": "Node.js v14 to v16" } From 17bcae9a1b7fed58142c238d54d682587373a740 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Tue, 26 Aug 2025 21:56:37 +0200 Subject: [PATCH 06/11] use correct casing --- apps/site/pages/en/learn/userland-migrations/introduction.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/site/pages/en/learn/userland-migrations/introduction.md b/apps/site/pages/en/learn/userland-migrations/introduction.md index 9a49027c8aabd..8937505e919d9 100644 --- a/apps/site/pages/en/learn/userland-migrations/introduction.md +++ b/apps/site/pages/en/learn/userland-migrations/introduction.md @@ -8,9 +8,9 @@ authors: JakobJingleheimer, AugustinMauroy # Userland Migrations -Node.js offers migrations for "userland" code (anything outside the node executable) to help adopt new features and handle breaking changes. These are built in collaboration with Codemod, a platform focused on making it easy to build, share, and run codemods. +Node.js offers migrations for "userland" code (anything outside the node executable) to help adopt new features and handle breaking changes. These are built in collaboration with [Codemod](https://codemod.com), a platform focused on making it easy to build, share, and run codemods. -Official migrations are published under the `@nodejs` scope within the [codemod registry](https://codemod.link/nodejs-official). These have been reviewed and/or authored by Node.js members. +Official migrations are published under the `@nodejs` scope within the [Codemod registry](https://codemod.link/nodejs-official). These have been reviewed and/or authored by Node.js members. ## Goal From 81ee06b11c4c01040d361bb2a6973dea950ebb02 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Mon, 22 Sep 2025 09:08:59 +0200 Subject: [PATCH 07/11] update --- .../learn/userland-migrations/introduction.md | 7 +++- .../learn/userland-migrations/v12-to-v14.md | 37 +++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 apps/site/pages/en/learn/userland-migrations/v12-to-v14.md diff --git a/apps/site/pages/en/learn/userland-migrations/introduction.md b/apps/site/pages/en/learn/userland-migrations/introduction.md index 8937505e919d9..b98f8ef142248 100644 --- a/apps/site/pages/en/learn/userland-migrations/introduction.md +++ b/apps/site/pages/en/learn/userland-migrations/introduction.md @@ -16,7 +16,7 @@ Official migrations are published under the `@nodejs` scope within the [Codemod The Node.js Userland Migrations team seeks to help developers migrate their codebases to the latest Node.js versions, making it easier to handle deprecations, new features, and breaking changes. -## How to use a Codemod +## How to use a codemod To use a codemod, you can run the following command in your terminal: @@ -37,6 +37,11 @@ npx codemod @nodejs/import-assertions-to-attributes - **Test your code**: After running a migration, it is important to test your code to ensure that everything is working as expected. Run your test suite and check for any errors or failures - **Format and or lint your code**: After running a migration, it is a good practice to format and lint your code. This ensures that your code follows the project's coding standards and is easier to read and maintain. +## Understanding Codemods Registry + +The [Codemod registry](https://codemod.link/nodejs-official) provides a list of available codemods for Node.js. +Some codemods may not be included in the following resources but are still available because they are not related to a specific migration to a Node.js version. Since we only list codemods for EoL deprecations, you may need to explore the registry for other codemods that could be useful for your migrations. + ## Feedback If you have any feedback or suggestions for improvements, please open an issue on the [Node.js Userland Migrations repository](https://github.com/nodejs/userland-migrations/issues). diff --git a/apps/site/pages/en/learn/userland-migrations/v12-to-v14.md b/apps/site/pages/en/learn/userland-migrations/v12-to-v14.md new file mode 100644 index 0000000000000..577987baada0d --- /dev/null +++ b/apps/site/pages/en/learn/userland-migrations/v12-to-v14.md @@ -0,0 +1,37 @@ +--- +title: Node.js v12 to v14 +layout: learn +authors: AugustinMauroy +--- + +# Node.js v12 to v14 + +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 the usage of log functions from util, `print`, `puts`, `debug`, `error` to use `console.log()` or `console.error()`. + +So this codemod handle [DEP0026](https://nodejs.org/api/deprecations.html#DEP0026), [DEP0027](https://nodejs.org/api/deprecations.html#DEP0027), [DEP0028](https://nodejs.org/api/deprecations.html#DEP0028) and [DEP0029](https://nodejs.org/api/deprecations.html#DEP0029). + +```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'); +``` From 6d86268ef709137610c7b0860dbd62ead9b7fd56 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:07:39 +0200 Subject: [PATCH 08/11] update after meeting --- apps/site/layouts/Blog.tsx | 1 + apps/site/navigation.json | 4 ++++ .../migrations}/v12-to-v14.md | 6 +++-- .../migrations}/v14-to-v16.md | 6 +++-- .../migrations}/v20-to-v22.md | 6 +++-- .../migrations}/v22-to-v24.md | 6 +++-- .../userland-migration.md} | 0 .../en/learn/userland-migrations/ecosystem.md | 23 ------------------- packages/i18n/src/locales/en.json | 14 +++-------- 9 files changed, 24 insertions(+), 42 deletions(-) rename apps/site/pages/en/{learn/userland-migrations => blog/migrations}/v12-to-v14.md (91%) rename apps/site/pages/en/{learn/userland-migrations => blog/migrations}/v14-to-v16.md (97%) rename apps/site/pages/en/{learn/userland-migrations => blog/migrations}/v20-to-v22.md (92%) rename apps/site/pages/en/{learn/userland-migrations => blog/migrations}/v22-to-v24.md (93%) rename apps/site/pages/en/learn/{userland-migrations/introduction.md => getting-started/userland-migration.md} (100%) delete mode 100644 apps/site/pages/en/learn/userland-migrations/ecosystem.md diff --git a/apps/site/layouts/Blog.tsx b/apps/site/layouts/Blog.tsx index c9d13d401aba8..aa389a952289b 100644 --- a/apps/site/layouts/Blog.tsx +++ b/apps/site/layouts/Blog.tsx @@ -63,6 +63,7 @@ const BlogLayout: FC = () => { 'announcements', 'release', 'vulnerability', + 'migrations', 'events', ])} /> diff --git a/apps/site/navigation.json b/apps/site/navigation.json index 9dfce2b381116..816f552ea4a1e 100644 --- a/apps/site/navigation.json +++ b/apps/site/navigation.json @@ -197,6 +197,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" } } }, diff --git a/apps/site/pages/en/learn/userland-migrations/v12-to-v14.md b/apps/site/pages/en/blog/migrations/v12-to-v14.md similarity index 91% rename from apps/site/pages/en/learn/userland-migrations/v12-to-v14.md rename to apps/site/pages/en/blog/migrations/v12-to-v14.md index 577987baada0d..a8baf09096b9e 100644 --- a/apps/site/pages/en/learn/userland-migrations/v12-to-v14.md +++ b/apps/site/pages/en/blog/migrations/v12-to-v14.md @@ -1,7 +1,9 @@ --- +date: '2025-09-26T12:00:00.000Z' +category: migrations title: Node.js v12 to v14 -layout: learn -authors: AugustinMauroy +layout: blog-post +author: AugustinMauroy --- # Node.js v12 to v14 diff --git a/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md b/apps/site/pages/en/blog/migrations/v14-to-v16.md similarity index 97% rename from apps/site/pages/en/learn/userland-migrations/v14-to-v16.md rename to apps/site/pages/en/blog/migrations/v14-to-v16.md index bba8e4a06bb3d..4aa9c7e2257cf 100644 --- a/apps/site/pages/en/learn/userland-migrations/v14-to-v16.md +++ b/apps/site/pages/en/blog/migrations/v14-to-v16.md @@ -1,7 +1,9 @@ --- +date: '2025-09-26T12:00:00.000Z' +category: migrations title: Node.js v14 to v16 -layout: learn -authors: AugustinMauroy +layout: blog-post +author: AugustinMauroy --- # Node.js v14 to v16 diff --git a/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md b/apps/site/pages/en/blog/migrations/v20-to-v22.md similarity index 92% rename from apps/site/pages/en/learn/userland-migrations/v20-to-v22.md rename to apps/site/pages/en/blog/migrations/v20-to-v22.md index efd3e7bbee4b3..fabc6a4edd8a8 100644 --- a/apps/site/pages/en/learn/userland-migrations/v20-to-v22.md +++ b/apps/site/pages/en/blog/migrations/v20-to-v22.md @@ -1,7 +1,9 @@ --- +date: '2025-09-26T12:00:00.000Z' +category: migrations title: Node.js v20 to v22 -layout: learn -authors: AugustinMauroy +layout: blog-post +author: AugustinMauroy --- # Node.js v20 to v22 diff --git a/apps/site/pages/en/learn/userland-migrations/v22-to-v24.md b/apps/site/pages/en/blog/migrations/v22-to-v24.md similarity index 93% rename from apps/site/pages/en/learn/userland-migrations/v22-to-v24.md rename to apps/site/pages/en/blog/migrations/v22-to-v24.md index b695310fbed4d..6a507aff83d84 100644 --- a/apps/site/pages/en/learn/userland-migrations/v22-to-v24.md +++ b/apps/site/pages/en/blog/migrations/v22-to-v24.md @@ -1,7 +1,9 @@ --- +date: '2025-09-26T12:00:00.000Z' +category: migrations title: Node.js v22 to v24 -layout: learn -authors: AugustinMauroy +layout: blog-post +author: AugustinMauroy --- # Node.js v22 to v24 diff --git a/apps/site/pages/en/learn/userland-migrations/introduction.md b/apps/site/pages/en/learn/getting-started/userland-migration.md similarity index 100% rename from apps/site/pages/en/learn/userland-migrations/introduction.md rename to apps/site/pages/en/learn/getting-started/userland-migration.md diff --git a/apps/site/pages/en/learn/userland-migrations/ecosystem.md b/apps/site/pages/en/learn/userland-migrations/ecosystem.md deleted file mode 100644 index 3579ef5179f20..0000000000000 --- a/apps/site/pages/en/learn/userland-migrations/ecosystem.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: Ecosystem to Node.js -layout: learn -authors: AugustinMauroy ---- - -# Ecosystem to Node.js - -Sometimes the ecosystem creates awesome tools or libraries for node.js, but a native alternative is present in Node.js. So, this page shows you codemod that handle this case. - -## `correct-ts-specifiers` - -When you want to [run typescript natively in Node.js](/learn/typescript/run-natively), you need to have a correct "specifiers" in your [imports statements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import). - -To run this codemod, you have to use this command: - -```bash -npx codemod run @nodejs/correct-ts-specifiers -``` - -## Feedback - -If you have any tools that you would like to be handle by userland-migrations, please open an issue on the [Node.js Userland Migrations repository](https://github.com/nodejs/userland-migrations/issues). diff --git a/packages/i18n/src/locales/en.json b/packages/i18n/src/locales/en.json index a0e3acda38b6a..4033c01c23274 100644 --- a/packages/i18n/src/locales/en.json +++ b/packages/i18n/src/locales/en.json @@ -48,7 +48,8 @@ "profiling": "Profiling Node.js Applications", "fetch": "Fetching data with Node.js", "websocket": "WebSocket client with Node.js", - "securityBestPractices": "Security Best Practices" + "securityBestPractices": "Security Best Practices", + "userlandMigrations": "Introduction to Userland Migrations" } }, "typescript": { @@ -98,16 +99,6 @@ "acceptInputFromTheCommandLineInNodejs": "Accept input from the command line in Node.js" } }, - "userland-migrations": { - "links": { - "userland-migrations": "Userland Migrations", - "introduction": "Introduction to Userland Migrations", - "ecosystem": "Ecosystem to Node.js", - "v22-to-v24": "Node.js v22 to v24", - "v20-to-v22": "Node.js v20 to v22", - "v14-to-v16": "Node.js v14 to v16" - } - }, "modules": { "links": { "modules": "Modules", @@ -338,6 +329,7 @@ "video": "Video", "weekly": "Weekly Updates", "wg": "Working Groups", + "migrations": "Migrations guides", "events": "Events" } }, From a009faf15ec3c1b4bc08e8fc9f88f2b3c41b800f Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:14:10 +0200 Subject: [PATCH 09/11] fix link --- .../{userland-migration.md => userland-migrations.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename apps/site/pages/en/learn/getting-started/{userland-migration.md => userland-migrations.md} (100%) diff --git a/apps/site/pages/en/learn/getting-started/userland-migration.md b/apps/site/pages/en/learn/getting-started/userland-migrations.md similarity index 100% rename from apps/site/pages/en/learn/getting-started/userland-migration.md rename to apps/site/pages/en/learn/getting-started/userland-migrations.md From c7d66ab6cf6fd0593c9c1ed280e08522ae822a9c Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:20:56 +0200 Subject: [PATCH 10/11] feat(mdx): add alertBox --- apps/site/next.mdx.use.mjs | 45 +++++++++++++++++++ .../{v12-to-v14.md => v12-to-v14.mdx} | 5 +++ .../{v14-to-v16.md => v14-to-v16.mdx} | 5 +++ .../{v20-to-v22.md => v20-to-v22.mdx} | 5 +++ .../{v22-to-v24.md => v22-to-v24.mdx} | 5 +++ 5 files changed, 65 insertions(+) create mode 100644 apps/site/next.mdx.use.mjs rename apps/site/pages/en/blog/migrations/{v12-to-v14.md => v12-to-v14.mdx} (84%) rename apps/site/pages/en/blog/migrations/{v14-to-v16.md => v14-to-v16.mdx} (94%) rename apps/site/pages/en/blog/migrations/{v20-to-v22.md => v20-to-v22.mdx} (86%) rename apps/site/pages/en/blog/migrations/{v22-to-v24.md => v22-to-v24.mdx} (87%) diff --git a/apps/site/next.mdx.use.mjs b/apps/site/next.mdx.use.mjs new file mode 100644 index 0000000000000..391cc9d54b23c --- /dev/null +++ b/apps/site/next.mdx.use.mjs @@ -0,0 +1,45 @@ +'use strict'; + +import AlertBox from '@node-core/ui-components/Common/AlertBox/index.js'; +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 = { + AlertBox, + 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, +}; diff --git a/apps/site/pages/en/blog/migrations/v12-to-v14.md b/apps/site/pages/en/blog/migrations/v12-to-v14.mdx similarity index 84% rename from apps/site/pages/en/blog/migrations/v12-to-v14.md rename to apps/site/pages/en/blog/migrations/v12-to-v14.mdx index a8baf09096b9e..7645a8112771c 100644 --- a/apps/site/pages/en/blog/migrations/v12-to-v14.md +++ b/apps/site/pages/en/blog/migrations/v12-to-v14.mdx @@ -8,6 +8,11 @@ author: AugustinMauroy # Node.js v12 to v14 + + This page provides a list of codemods to help you migrate your code from Node.js v12 to v14. ## `util-print-to-console-log` diff --git a/apps/site/pages/en/blog/migrations/v14-to-v16.md b/apps/site/pages/en/blog/migrations/v14-to-v16.mdx similarity index 94% rename from apps/site/pages/en/blog/migrations/v14-to-v16.md rename to apps/site/pages/en/blog/migrations/v14-to-v16.mdx index 4aa9c7e2257cf..6b80a499ff038 100644 --- a/apps/site/pages/en/blog/migrations/v14-to-v16.md +++ b/apps/site/pages/en/blog/migrations/v14-to-v16.mdx @@ -8,6 +8,11 @@ author: AugustinMauroy # Node.js v14 to v16 + + This page provides a list of codemods to help you migrate your code from Node.js v14 to v16. ## `create-require-from-path` diff --git a/apps/site/pages/en/blog/migrations/v20-to-v22.md b/apps/site/pages/en/blog/migrations/v20-to-v22.mdx similarity index 86% rename from apps/site/pages/en/blog/migrations/v20-to-v22.md rename to apps/site/pages/en/blog/migrations/v20-to-v22.mdx index fabc6a4edd8a8..c21f1ea735950 100644 --- a/apps/site/pages/en/blog/migrations/v20-to-v22.md +++ b/apps/site/pages/en/blog/migrations/v20-to-v22.mdx @@ -8,6 +8,11 @@ author: AugustinMauroy # Node.js v20 to v22 + + This page provides a list of codemods to help you migrate your code from Node.js v20 to v22. ## `import-assertions-to-attributes` diff --git a/apps/site/pages/en/blog/migrations/v22-to-v24.md b/apps/site/pages/en/blog/migrations/v22-to-v24.mdx similarity index 87% rename from apps/site/pages/en/blog/migrations/v22-to-v24.md rename to apps/site/pages/en/blog/migrations/v22-to-v24.mdx index 6a507aff83d84..f9300a94bfab6 100644 --- a/apps/site/pages/en/blog/migrations/v22-to-v24.md +++ b/apps/site/pages/en/blog/migrations/v22-to-v24.mdx @@ -8,6 +8,11 @@ author: AugustinMauroy # Node.js v22 to v24 + + This page provides a list of codemods to help you migrate your code from Node.js v22 to v24. ## `fs-access-mode-constants` From 464acd95da6662c0b69f7be2f46237725a4d4925 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Fri, 26 Sep 2025 09:29:16 +0200 Subject: [PATCH 11/11] fix --- apps/site/mdx/components.mjs | 3 +++ apps/site/next.mdx.use.mjs | 2 -- apps/site/pages/en/blog/migrations/v12-to-v14.mdx | 9 +++++---- apps/site/pages/en/blog/migrations/v20-to-v22.mdx | 9 +++++---- apps/site/pages/en/blog/migrations/v22-to-v24.mdx | 9 +++++---- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/apps/site/mdx/components.mjs b/apps/site/mdx/components.mjs index 74fc4074e2e6f..12114686e57f3 100644 --- a/apps/site/mdx/components.mjs +++ b/apps/site/mdx/components.mjs @@ -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'; @@ -46,6 +47,8 @@ export default { blockquote: Blockquote, pre: MDXCodeBox, img: MDXImage, + // Allow the writter to use an pretty alert box + AlertBox, // Renders MDX CodeTabs CodeTabs: MDXCodeTabs, // Renders a Download Button diff --git a/apps/site/next.mdx.use.mjs b/apps/site/next.mdx.use.mjs index 391cc9d54b23c..0362afd15024d 100644 --- a/apps/site/next.mdx.use.mjs +++ b/apps/site/next.mdx.use.mjs @@ -1,6 +1,5 @@ 'use strict'; -import AlertBox from '@node-core/ui-components/Common/AlertBox/index.js'; import BadgeGroup from '@node-core/ui-components/Common/BadgeGroup'; import Button from './components/Common/Button'; @@ -20,7 +19,6 @@ import WithNodeRelease from './components/withNodeRelease'; * @satisfies {import('mdx/types').MDXComponents} */ export const mdxComponents = { - AlertBox, PreviousReleasesTable, // HOC for getting Node.js Release Metadata WithNodeRelease, 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 7645a8112771c..7582c3e3d83dd 100644 --- a/apps/site/pages/en/blog/migrations/v12-to-v14.mdx +++ b/apps/site/pages/en/blog/migrations/v12-to-v14.mdx @@ -8,10 +8,11 @@ author: AugustinMauroy # Node.js v12 to v14 - + + 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. + This page provides a list of codemods to help you migrate your code from Node.js v12 to v14. diff --git a/apps/site/pages/en/blog/migrations/v20-to-v22.mdx b/apps/site/pages/en/blog/migrations/v20-to-v22.mdx index c21f1ea735950..39346be69791b 100644 --- a/apps/site/pages/en/blog/migrations/v20-to-v22.mdx +++ b/apps/site/pages/en/blog/migrations/v20-to-v22.mdx @@ -8,10 +8,11 @@ author: AugustinMauroy # Node.js v20 to v22 - + + This article cover a part of the migration from Node.js v20 to v22. The + userland migrations team is working on more codemods to help you with the + migration. + This page provides a list of codemods to help you migrate your code from Node.js v20 to v22. 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 f9300a94bfab6..0d97c60ac9610 100644 --- a/apps/site/pages/en/blog/migrations/v22-to-v24.mdx +++ b/apps/site/pages/en/blog/migrations/v22-to-v24.mdx @@ -8,10 +8,11 @@ author: AugustinMauroy # Node.js v22 to v24 - + + This article cover a part of the migration from Node.js v22 to v24. The + userland migrations team is working on more codemods to help you with the + migration. + This page provides a list of codemods to help you migrate your code from Node.js v22 to v24.