From 642633bf3a6b9d6185e95dad229e164ca40e6c49 Mon Sep 17 00:00:00 2001 From: joaquimpeixoto Date: Wed, 27 May 2026 15:49:32 +0100 Subject: [PATCH 1/4] feat: add asdf install method --- apps/site/snippets/en/download/asdf.bash | 11 +++++++++++ apps/site/types/release.ts | 3 ++- apps/site/util/download/constants.json | 9 +++++++++ apps/site/util/download/index.tsx | 11 ++++++++++- packages/i18n/src/locales/en.json | 1 + 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 apps/site/snippets/en/download/asdf.bash diff --git a/apps/site/snippets/en/download/asdf.bash b/apps/site/snippets/en/download/asdf.bash new file mode 100644 index 0000000000000..65043c92a732b --- /dev/null +++ b/apps/site/snippets/en/download/asdf.bash @@ -0,0 +1,11 @@ +# asdf has specific installation instructions for each operating system. +# Please refer to the official documentation at https://asdf-vm.com/guide/getting-started.html. + +# Install the Node.js plugin: +asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git + +# Download and install Node.js: +asdf install nodejs ${props.release.version} + +# Set Node.js as the global default: +asdf set -u nodejs ${props.release.version} diff --git a/apps/site/types/release.ts b/apps/site/types/release.ts index baa01aa40b38d..9ffc705f73490 100644 --- a/apps/site/types/release.ts +++ b/apps/site/types/release.ts @@ -8,7 +8,8 @@ export type InstallationMethod = | 'BREW' | 'DOCKER' | 'CHOCO' - | 'N'; + | 'N' + | 'ASDF'; export type PackageManager = 'NPM' | 'YARN' | 'PNPM'; // Items with a pipe/default value mean that they are auto inferred diff --git a/apps/site/util/download/constants.json b/apps/site/util/download/constants.json index d5ccf208ccf5b..1a349025d003c 100644 --- a/apps/site/util/download/constants.json +++ b/apps/site/util/download/constants.json @@ -187,6 +187,15 @@ }, "url": "https://github.com/tj/n", "info": "layouts.download.codeBox.platformInfo.n" + }, + { + "id": "ASDF", + "name": "asdf", + "compatibility": { + "os": ["MAC", "LINUX"] + }, + "url": "https://asdf-vm.com/guide/getting-started.html", + "info": "layouts.download.codeBox.platformInfo.asdf" } ], "packageManagers": [ diff --git a/apps/site/util/download/index.tsx b/apps/site/util/download/index.tsx index 78ad149d1fb15..6e02726aae919 100644 --- a/apps/site/util/download/index.tsx +++ b/apps/site/util/download/index.tsx @@ -78,9 +78,18 @@ export const parseCompat = < */ const createIcon = ( IconModule: Record, - iconName: string + iconName?: string ) => { + if (!iconName) { + return undefined; + } + const IconComponent = IconModule[iconName]; + + if (!IconComponent) { + return undefined; + } + return ; }; diff --git a/packages/i18n/src/locales/en.json b/packages/i18n/src/locales/en.json index d177c91c3a4ef..4fbbeb0c19b46 100644 --- a/packages/i18n/src/locales/en.json +++ b/packages/i18n/src/locales/en.json @@ -299,6 +299,7 @@ "choco": "Chocolatey is a package manager for Windows.", "docker": "Docker is a containerization platform.", "n": "\"n\" is a cross-platform Node.js version manager.", + "asdf": "\"asdf\" is a cross-platform version manager that supports multiple languages.", "volta": "\"Volta\" is a cross-platform Node.js version manager." } } From e318ab6818e70c88e9c4ad8258681c8ba1d88b2a Mon Sep 17 00:00:00 2001 From: joaquimpeixoto Date: Wed, 27 May 2026 16:21:43 +0100 Subject: [PATCH 2/4] address asdf install feedback --- apps/site/snippets/en/download/asdf.bash | 2 +- apps/site/util/download/index.tsx | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/site/snippets/en/download/asdf.bash b/apps/site/snippets/en/download/asdf.bash index 65043c92a732b..31beb7e8385d0 100644 --- a/apps/site/snippets/en/download/asdf.bash +++ b/apps/site/snippets/en/download/asdf.bash @@ -8,4 +8,4 @@ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git asdf install nodejs ${props.release.version} # Set Node.js as the global default: -asdf set -u nodejs ${props.release.version} +asdf global nodejs ${props.release.version} diff --git a/apps/site/util/download/index.tsx b/apps/site/util/download/index.tsx index 6e02726aae919..a8eb5e542060b 100644 --- a/apps/site/util/download/index.tsx +++ b/apps/site/util/download/index.tsx @@ -86,10 +86,6 @@ const createIcon = ( const IconComponent = IconModule[iconName]; - if (!IconComponent) { - return undefined; - } - return ; }; From 3de00f988119f2563ddfb7100dc0415d2dc445ad Mon Sep 17 00:00:00 2001 From: joaquimpeixoto Date: Wed, 27 May 2026 16:36:15 +0100 Subject: [PATCH 3/4] update asdf snippet syntax --- apps/site/snippets/en/download/asdf.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/site/snippets/en/download/asdf.bash b/apps/site/snippets/en/download/asdf.bash index 31beb7e8385d0..cde0aa49a06a8 100644 --- a/apps/site/snippets/en/download/asdf.bash +++ b/apps/site/snippets/en/download/asdf.bash @@ -1,5 +1,6 @@ # asdf has specific installation instructions for each operating system. # Please refer to the official documentation at https://asdf-vm.com/guide/getting-started.html. +# This snippet uses asdf v0.16+ command syntax. # Install the Node.js plugin: asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git @@ -8,4 +9,4 @@ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git asdf install nodejs ${props.release.version} # Set Node.js as the global default: -asdf global nodejs ${props.release.version} +asdf set --home nodejs ${props.release.version} From a977017d4a9d49cc6c631f5f07f6d2b7654af79f Mon Sep 17 00:00:00 2001 From: joaquimpeixoto Date: Wed, 27 May 2026 18:22:24 +0100 Subject: [PATCH 4/4] test: cover install method icon mapping --- apps/site/util/__tests__/download.test.mjs | 10 ++++++++++ apps/site/util/download/index.tsx | 11 ++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/site/util/__tests__/download.test.mjs b/apps/site/util/__tests__/download.test.mjs index d4bd959de1073..c1aa3ffd1c655 100644 --- a/apps/site/util/__tests__/download.test.mjs +++ b/apps/site/util/__tests__/download.test.mjs @@ -144,3 +144,13 @@ describe('nextItem', () => { assert.equal(nextItem('valid', items), 'valid'); }); }); + +describe('INSTALL_METHODS', () => { + it('should create icons only when an icon is configured', () => { + const nvmMethod = INSTALL_METHODS.find(method => method.value === 'NVM'); + const asdfMethod = INSTALL_METHODS.find(method => method.value === 'ASDF'); + + assert.ok(nvmMethod?.iconImage); + assert.equal(asdfMethod?.iconImage, undefined); + }); +}); diff --git a/apps/site/util/download/index.tsx b/apps/site/util/download/index.tsx index a8eb5e542060b..69713f4fb005a 100644 --- a/apps/site/util/download/index.tsx +++ b/apps/site/util/download/index.tsx @@ -78,14 +78,9 @@ export const parseCompat = < */ const createIcon = ( IconModule: Record, - iconName?: string + iconName: string ) => { - if (!iconName) { - return undefined; - } - const IconComponent = IconModule[iconName]; - return ; }; @@ -105,7 +100,9 @@ export const INSTALL_METHODS = installMethods.map(method => ({ key: method.id, value: method.id as Types.InstallationMethod, label: method.name as IntlMessageKeys, - iconImage: createIcon(InstallMethodIcons, method.icon), + iconImage: method.icon + ? createIcon(InstallMethodIcons, method.icon) + : undefined, recommended: method.recommended, url: method.url, info: method.info as IntlMessageKeys,