diff --git a/.gitignore b/.gitignore index 7f47879b973a9..aef8ec50a2dbe 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ node_modules npm-debug.log .npm -.env.local +.env.* # Next.js Build Output .next diff --git a/components/Common/Badge/index.tsx b/components/Common/Badge/index.tsx index 258b32312b07d..8463fccf52e62 100644 --- a/components/Common/Badge/index.tsx +++ b/components/Common/Badge/index.tsx @@ -19,7 +19,7 @@ const Badge: FC> = ({ {badgeText && {badgeText}} {children} - + {args.href && } ); diff --git a/components/Downloads/Release/ReleaseCodeBox.tsx b/components/Downloads/Release/ReleaseCodeBox.tsx index eb31dfe38a038..d0446c3f481d9 100644 --- a/components/Downloads/Release/ReleaseCodeBox.tsx +++ b/components/Downloads/Release/ReleaseCodeBox.tsx @@ -43,9 +43,9 @@ const ReleaseCodeBox: FC = () => { )} - {t('layouts.download.codeBox.managerInstalled')} -
{t('layouts.download.codeBox.communityWarning')} +
+ {t('layouts.download.codeBox.communityWarningReport')}
); diff --git a/components/withDownloadCategories.tsx b/components/withDownloadCategories.tsx index 4710a53952d12..4f85137d7e9f8 100644 --- a/components/withDownloadCategories.tsx +++ b/components/withDownloadCategories.tsx @@ -28,16 +28,16 @@ const WithDownloadCategories: FC = async ({ children }) => { page: page, categories: [ { - category: 'download', - label: t('layouts.download.categories.download'), + category: 'package-manager', + label: t('layouts.download.categories.package-manager'), }, { - category: 'prebuilt-binaries', - label: t('layouts.download.categories.prebuilt-binaries'), + category: 'prebuilt-installer', + label: t('layouts.download.categories.prebuilt-installer'), }, { - category: 'package-manager', - label: t('layouts.download.categories.package-manager'), + category: 'prebuilt-binaries', + label: t('layouts.download.categories.prebuilt-binaries'), }, { category: 'source-code', diff --git a/i18n/locales/en.json b/i18n/locales/en.json index 419539f8621a7..6d5e88ddaf8a4 100644 --- a/i18n/locales/en.json +++ b/i18n/locales/en.json @@ -268,7 +268,7 @@ "download": { "selectCategory": "Categories", "categories": { - "download": "Prebuilt Installer", + "prebuilt-installer": "Prebuilt Installer", "prebuilt-binaries": "Prebuilt Binaries", "package-manager": "Package Manager", "source-code": "Source Code" @@ -284,8 +284,9 @@ "platform": "Platform" }, "codeBox": { - "managerInstalled": "Please ensure you have the right package manager installed before running a script.", - "communityWarning": "Package managers and their installation scripts are not maintained by the Node.js project." + "systemManagerWarning": "is not a Node.js package manager. Please ensure you already have {packageManager} installed.", + "communityWarning": "Package managers and their installation scripts are not maintained by the Node.js project.", + "communityWarningReport": "If you encounter issues, please reach out to the package manager's maintainers." } } } diff --git a/pages/en/download/current.mdx b/pages/en/download/prebuilt-installer/current.mdx similarity index 100% rename from pages/en/download/current.mdx rename to pages/en/download/prebuilt-installer/current.mdx diff --git a/pages/en/download/index.mdx b/pages/en/download/prebuilt-installer/index.mdx similarity index 100% rename from pages/en/download/index.mdx rename to pages/en/download/prebuilt-installer/index.mdx diff --git a/redirects.json b/redirects.json index 97ee72ad89467..5107665b2d297 100644 --- a/redirects.json +++ b/redirects.json @@ -271,6 +271,14 @@ { "source": "/:locale/blog/weekly-updates/:path*", "destination": "/:locale/blog/weekly/:path*" + }, + { + "source": "/:locale/download", + "destination": "/:locale/download/package-manager" + }, + { + "source": "/:locale/download/current", + "destination": "/:locale/download/package-manager/current" } ], "internal": [] diff --git a/util/__tests__/downloadUtils.test.mjs b/util/__tests__/downloadUtils.test.mjs index fba82ecc2687c..f879487bab25a 100644 --- a/util/__tests__/downloadUtils.test.mjs +++ b/util/__tests__/downloadUtils.test.mjs @@ -103,8 +103,8 @@ describe('mapCategoriesToTabs', () => { page: 'download', categories: [ { - category: 'download', - label: 'Download', + category: 'prebuilt-binaries', + label: 'Prebuilt Binaries', }, { category: 'package-manager', @@ -115,7 +115,11 @@ describe('mapCategoriesToTabs', () => { }); expect(result).toEqual([ - { key: 'download', label: 'Download', link: '/download/current' }, + { + key: 'prebuilt-binaries', + label: 'Prebuilt Binaries', + link: '/download/prebuilt-binaries/current', + }, { key: 'package-manager', label: 'Package Manager', @@ -129,8 +133,8 @@ describe('mapCategoriesToTabs', () => { page: 'download', categories: [ { - category: 'download', - label: 'Download', + category: 'prebuilt-binaries', + label: 'Prebuilt Binaries', }, { category: 'package-manager', @@ -140,7 +144,11 @@ describe('mapCategoriesToTabs', () => { }); expect(result).toEqual([ - { key: 'download', label: 'Download', link: '/download' }, + { + key: 'prebuilt-binaries', + label: 'Prebuilt Binaries', + link: '/download/prebuilt-binaries', + }, { key: 'package-manager', label: 'Package Manager', diff --git a/util/downloadUtils.ts b/util/downloadUtils.ts index a29432812a96f..9a63c751a10e7 100644 --- a/util/downloadUtils.ts +++ b/util/downloadUtils.ts @@ -1,8 +1,7 @@ import type { PackageManager } from '@/types/release'; import type { UserOS } from '@/types/userOS'; -// A utility enum to help convert `userOs` data type to user-readable format -export enum OperatingSystem { +export enum OperatingSystemLabel { WIN = 'Windows', MAC = 'macOS', LINUX = 'Linux', @@ -10,44 +9,52 @@ export enum OperatingSystem { OTHER = 'Other', } +export enum PackageManagerLabel { + NVM = 'nvm', + FNM = 'fnm', + BREW = 'Brew', + CHOCO = 'Chocolatey', + DOCKER = 'Docker', +} + export const operatingSystemItems = [ { - label: OperatingSystem.WIN, + label: OperatingSystemLabel.WIN, value: 'WIN' as UserOS, }, { - label: OperatingSystem.MAC, + label: OperatingSystemLabel.MAC, value: 'MAC' as UserOS, }, { - label: OperatingSystem.LINUX, + label: OperatingSystemLabel.LINUX, value: 'LINUX' as UserOS, }, { - label: OperatingSystem.AIX, + label: OperatingSystemLabel.AIX, value: 'AIX' as UserOS, }, ]; export const platformItems = [ { - label: 'nvm', + label: PackageManagerLabel.NVM, value: 'NVM' as PackageManager, }, { - label: 'fnm', + label: PackageManagerLabel.FNM, value: 'FNM' as PackageManager, }, { - label: 'Brew', + label: PackageManagerLabel.BREW, value: 'BREW' as PackageManager, }, { - label: 'Chocolatey', + label: PackageManagerLabel.CHOCO, value: 'CHOCO' as PackageManager, }, { - label: 'Docker', + label: PackageManagerLabel.DOCKER, value: 'DOCKER' as PackageManager, }, ]; @@ -160,8 +167,5 @@ export const mapCategoriesToTabs = ({ categories.map(({ category, label }) => ({ key: category, label: label, - link: - category === 'download' - ? `/${[page, subCategory].filter(Boolean).join('/')}` - : `/${[page, category, subCategory].filter(Boolean).join('/')}`, + link: `/${[page, category, subCategory].filter(Boolean).join('/')}`, })); diff --git a/util/getNodeDownloadSnippet.ts b/util/getNodeDownloadSnippet.ts index 8f0d27fb5bdab..e4a7cfc15e6d5 100644 --- a/util/getNodeDownloadSnippet.ts +++ b/util/getNodeDownloadSnippet.ts @@ -4,6 +4,7 @@ import type { NodeRelease } from '@/types'; import type { PackageManager } from '@/types/release'; import type { UserOS } from '@/types/userOS'; +// @TODO: These snippets should be extracted to i18n (?) export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => { const snippets: Record = { NVM: '', @@ -15,6 +16,11 @@ export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => { if (os === 'WIN' || os === 'MAC' || os === 'LINUX') { snippets.DOCKER = dedent` + # NOTE: + # Docker is not a Node.js package manager. Please ensure it is already installed + # on your system. Follow official instructions at https://docs.docker.com/desktop/ + # Docker images are provided officially at https://github.com/nodejs/docker-node/ + # pulls the Node.js Docker image docker pull node:${release.major}-${release.major >= 4 ? 'alpine' : 'slim'} @@ -53,6 +59,12 @@ export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => { npm -v # should print \`${release.npm}\``; snippets.BREW = dedent` + # NOTE: + # Homebrew is not a Node.js package manager. Please ensure it is already installed + # on your system. Follow official instructions at https://brew.sh/ + # Homebrew only supports installing major Node.js versions and might not support + # the latest Node.js version from the ${release.major} release line. + # download and install Node.js brew install node@${release.major} @@ -78,11 +90,17 @@ export const getNodeDownloadSnippet = (release: NodeRelease, os: UserOS) => { npm -v # should print \`${release.npm}\``; snippets.CHOCO = dedent` + # NOTE: + # Chocolatey is not a Node.js package manager. Please ensure it is already installed + # on your system. Follow official instructions at https://chocolatey.org/ + # Chocolatey is not officially maintained by the Node.js project and might not + # support the ${release.versionWithPrefix} version of Node.js + # download and install Node.js choco install nodejs${release.isLts ? '-lts' : ''} --version="${release.version}" # verifies the right Node.js version is in the environment - node -v # should print \`${release.versionWithPrefix}\` + node -v # should print \`${release.major}\` # verifies the right NPM version is in the environment npm -v # should print \`${release.npm}\``;