From 01ffa2a21916245edfc277fe8999f3f0775df30e Mon Sep 17 00:00:00 2001 From: Cameron Tacklind Date: Tue, 30 Jul 2024 14:57:44 -0700 Subject: [PATCH 1/2] refactor: Fix typos in variable names --- apps/site/i18n/locales/en.json | 4 ++-- apps/site/util/getNodeDownloadSnippet.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/site/i18n/locales/en.json b/apps/site/i18n/locales/en.json index b2f9ef45f86e..50d2531ddf2d 100644 --- a/apps/site/i18n/locales/en.json +++ b/apps/site/i18n/locales/en.json @@ -303,7 +303,7 @@ "activateFNM": "activate fnm", "noteWithColon": "NOTE:", "dockerIsNotNodejsPackageManager": "Docker is not a Node.js package manager.", - "PleaseEndureAlreadyInstallOnSystem": "Please ensure it is already installed on your system.", + "PleaseEnsureAlreadyInstallOnSystem": "Please ensure it is already installed on your system.", "dockerInstructions": "Follow official instructions at https://docs.docker.com/desktop/", "dockerImagesLink": "Docker images are provided officially at https://github.com/nodejs/docker-node/", "pullsNodejsDockerImage": "pulls the Node.js Docker image", @@ -312,7 +312,7 @@ "homebrewSupportsIntallingMajorNodejsVersion": "Homebrew only supports installing major Node.js versions and might not support the latest Node.js version from the {version} release line.", "chocolateyIsNotNodejsPackageManager": "Chocolatey is not a Node.js package manager.", "chocolateyInstructions": "Follow official instructions at https://chocolatey.org/", - "chocolateyNotMaintanedByNodejs": "Chocolatey is not officially maintained by the Node.js project and might not support the {version} version of Node.js" + "chocolateyNotMaintainedByNodejs": "Chocolatey is not officially maintained by the Node.js project and might not support the {version} version of Node.js" } } } diff --git a/apps/site/util/getNodeDownloadSnippet.ts b/apps/site/util/getNodeDownloadSnippet.ts index 43083610ecec..0eb424805b90 100644 --- a/apps/site/util/getNodeDownloadSnippet.ts +++ b/apps/site/util/getNodeDownloadSnippet.ts @@ -22,7 +22,7 @@ export const getNodeDownloadSnippet = ( snippets.DOCKER = dedent` # ${t('layouts.download.codeBox.noteWithColon')} # ${t('layouts.download.codeBox.dockerIsNotNodejsPackageManager')} - # ${t('layouts.download.codeBox.PleaseEndureAlreadyInstallOnSystem')} + # ${t('layouts.download.codeBox.PleaseEnsureAlreadyInstallOnSystem')} # ${t('layouts.download.codeBox.dockerInstructions')} # ${t('layouts.download.codeBox.dockerImagesLink')} @@ -69,7 +69,7 @@ export const getNodeDownloadSnippet = ( snippets.BREW = dedent` # ${t('layouts.download.codeBox.noteWithColon')} # ${t('layouts.download.codeBox.homebrewIsNotNodejsPackageManager')} - # ${t('layouts.download.codeBox.PleaseEndureAlreadyInstallOnSystem')} + # ${t('layouts.download.codeBox.PleaseEnsureAlreadyInstallOnSystem')} # ${t('layouts.download.codeBox.homebrewInstructions')} # ${t('layouts.download.codeBox.homebrewSupportsIntallingMajorNodejsVersion', { version: release.major })} @@ -100,9 +100,9 @@ export const getNodeDownloadSnippet = ( snippets.CHOCO = dedent` # ${t('layouts.download.codeBox.noteWithColon')} # ${t('layouts.download.codeBox.chocolateyIsNotNodejsPackageManager')} - # ${t('layouts.download.codeBox.PleaseEndureAlreadyInstallOnSystem')} + # ${t('layouts.download.codeBox.PleaseEnsureAlreadyInstallOnSystem')} # ${t('layouts.download.codeBox.chocolateyInstructions')} - # ${t('layouts.download.codeBox.chocolateyNotMaintanedByNodejs', { version: release.versionWithPrefix })} + # ${t('layouts.download.codeBox.chocolateyNotMaintainedByNodejs', { version: release.versionWithPrefix })} # ${t('layouts.download.codeBox.downloadAndInstallNodejs')} choco install nodejs${release.isLts ? '-lts' : ''} --version="${release.version}" From de28eb67efc255f2f958525d714911bc0b951f16 Mon Sep 17 00:00:00 2001 From: Cameron Tacklind Date: Tue, 30 Jul 2024 15:29:59 -0700 Subject: [PATCH 2/2] docs: Add WinGet as a listed way to install Node.js --- .../Downloads/Release/PlatformDropdown.tsx | 4 +++- .../site/components/Icons/Platform/WinGet.tsx | 21 +++++++++++++++++++ apps/site/i18n/locales/en.json | 3 +++ apps/site/types/release.ts | 2 +- apps/site/util/downloadUtils.ts | 5 +++++ apps/site/util/getNodeDownloadSnippet.ts | 17 +++++++++++++++ 6 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 apps/site/components/Icons/Platform/WinGet.tsx diff --git a/apps/site/components/Downloads/Release/PlatformDropdown.tsx b/apps/site/components/Downloads/Release/PlatformDropdown.tsx index a4839ae966f4..7c84d4b60c00 100644 --- a/apps/site/components/Downloads/Release/PlatformDropdown.tsx +++ b/apps/site/components/Downloads/Release/PlatformDropdown.tsx @@ -4,6 +4,7 @@ import { useContext, useEffect, useMemo } from 'react'; import type { FC } from 'react'; import Select from '@/components/Common/Select'; +import WinGet from '@/components/Icons/Platform/WinGet'; import Choco from '@/components/Icons/Platform/Choco'; import Docker from '@/components/Icons/Platform/Docker'; import FNM from '@/components/Icons/Platform/FNM'; @@ -31,7 +32,7 @@ const PlatformDropdown: FC = () => { } if (os === 'LINUX' || os === 'MAC') { - disabledItems.push('CHOCO'); + disabledItems.push('WINGET', 'CHOCO'); } const releaseSupportsHomebrew = supportedHomebrewVersions.includes( @@ -68,6 +69,7 @@ const PlatformDropdown: FC = () => { values={formatDropdownItems({ items: platformItems, icons: { + WINGET: , NVM: , FNM: , BREW: , diff --git a/apps/site/components/Icons/Platform/WinGet.tsx b/apps/site/components/Icons/Platform/WinGet.tsx new file mode 100644 index 000000000000..7be80d75f350 --- /dev/null +++ b/apps/site/components/Icons/Platform/WinGet.tsx @@ -0,0 +1,21 @@ +import type { FC, SVGProps } from 'react'; + +const WinGet: FC> = props => ( + // TODO: Use real svg for WinGet: https://github.com/microsoft/winget-cli/issues/4691 + // For now, the Windows logo is used as a placeholder + + + + + + +); + +export default WinGet; diff --git a/apps/site/i18n/locales/en.json b/apps/site/i18n/locales/en.json index 50d2531ddf2d..417bab323bbd 100644 --- a/apps/site/i18n/locales/en.json +++ b/apps/site/i18n/locales/en.json @@ -310,6 +310,9 @@ "homebrewIsNotNodejsPackageManager": "Homebrew is not a Node.js package manager.", "homebrewInstructions": "Follow official instructions at https://brew.sh/", "homebrewSupportsIntallingMajorNodejsVersion": "Homebrew only supports installing major Node.js versions and might not support the latest Node.js version from the {version} release line.", + "wingetIsNotNodejsPackageManager": "The Windows Package Manager is not a Node.js package manager.", + "wingetInstructions": "Follow official instructions at https://learn.microsoft.com/en-us/windows/package-manager/winget/install", + "wingetNotMaintainedByNodejs": "WinGet is not officially maintained by the Node.js project and might not support the {version} version of Node.js", "chocolateyIsNotNodejsPackageManager": "Chocolatey is not a Node.js package manager.", "chocolateyInstructions": "Follow official instructions at https://chocolatey.org/", "chocolateyNotMaintainedByNodejs": "Chocolatey is not officially maintained by the Node.js project and might not support the {version} version of Node.js" diff --git a/apps/site/types/release.ts b/apps/site/types/release.ts index b1e794e940c8..2824735f3558 100644 --- a/apps/site/types/release.ts +++ b/apps/site/types/release.ts @@ -3,7 +3,7 @@ import type { ReactNode } from 'react'; import type { NodeRelease } from '@/types/releases'; import type { UserOS } from '@/types/userOS'; -export type PackageManager = 'NVM' | 'FNM' | 'BREW' | 'DOCKER' | 'CHOCO'; +export type PackageManager = 'NVM' | 'FNM' | 'BREW' | 'DOCKER' | 'WINGET' | 'CHOCO'; export interface ReleaseState { os: UserOS; diff --git a/apps/site/util/downloadUtils.ts b/apps/site/util/downloadUtils.ts index 9a63c751a10e..833e254cbcb3 100644 --- a/apps/site/util/downloadUtils.ts +++ b/apps/site/util/downloadUtils.ts @@ -13,6 +13,7 @@ export enum PackageManagerLabel { NVM = 'nvm', FNM = 'fnm', BREW = 'Brew', + WINGET = 'WinGet', CHOCO = 'Chocolatey', DOCKER = 'Docker', } @@ -37,6 +38,10 @@ export const operatingSystemItems = [ ]; export const platformItems = [ + { + label: PackageManagerLabel.WINGET, + value: 'WINGET' as PackageManager, + }, { label: PackageManagerLabel.NVM, value: 'NVM' as PackageManager, diff --git a/apps/site/util/getNodeDownloadSnippet.ts b/apps/site/util/getNodeDownloadSnippet.ts index 0eb424805b90..7a8944bdd76a 100644 --- a/apps/site/util/getNodeDownloadSnippet.ts +++ b/apps/site/util/getNodeDownloadSnippet.ts @@ -15,6 +15,7 @@ export const getNodeDownloadSnippet = ( FNM: '', BREW: '', DOCKER: '', + WINGET: '', CHOCO: '', }; @@ -84,6 +85,22 @@ export const getNodeDownloadSnippet = ( } if (os === 'WIN') { + snippets.WINGET = dedent` + # ${t('layouts.download.codeBox.noteWithColon')} + # ${t('layouts.download.codeBox.wingetIsNotNodejsPackageManager')} + # ${t('layouts.download.codeBox.PleaseEnsureAlreadyInstallOnSystem')} + # ${t('layouts.download.codeBox.wingetInstructions')} + # ${t('layouts.download.codeBox.wingetNotMaintainedByNodejs', { version: release.versionWithPrefix })} + + # ${t('layouts.download.codeBox.downloadAndInstallNodejs')} + winget install -e --id OpenJS.NodeJS${release.isLts ? '.LTS' : ''} -v ${release.version} + + # ${t('layouts.download.codeBox.verifiesRightNodejsVersion')} + node -v # ${t('layouts.download.codeBox.shouldPrint', { version: release.versionWithPrefix })} + + # ${t('layouts.download.codeBox.verifiesRightNpmVersion')} + npm -v # ${t('layouts.download.codeBox.shouldPrint', { version: release.npm })}`; + snippets.FNM = dedent` # ${t('layouts.download.codeBox.installsFnm')} winget install Schniz.fnm