diff --git a/apps/site/snippets/en/download/asdf.bash b/apps/site/snippets/en/download/asdf.bash new file mode 100644 index 0000000000000..cde0aa49a06a8 --- /dev/null +++ b/apps/site/snippets/en/download/asdf.bash @@ -0,0 +1,12 @@ +# 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 + +# Download and install Node.js: +asdf install nodejs ${props.release.version} + +# Set Node.js as the global default: +asdf set --home 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/__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/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..69713f4fb005a 100644 --- a/apps/site/util/download/index.tsx +++ b/apps/site/util/download/index.tsx @@ -100,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, 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." } }