From f8cad86cc27cc182340bbdfdc8fb38f6a0d53cba Mon Sep 17 00:00:00 2001 From: Imamuzzaki Abu Salam Date: Sun, 4 Aug 2024 12:36:35 +0700 Subject: [PATCH] feat: add support for Proto package manager This commit adds support for the Proto package manager in the site/types/release.ts, site/util/downloadUtils.ts, components/Downloads/Release/PlatformDropdown.tsx, and components/Icons/Platform/Proto.tsx files. The Proto package manager is now included as an option in the PackageManager enum and the platformItems array. The PlatformDropdown component has been updated to display the Proto icon. Additionally, the en.json file has been updated to include instructions for installing Proto. --- .../Downloads/Release/PlatformDropdown.tsx | 4 +- apps/site/components/Icons/Platform/Proto.tsx | 19 +++++ apps/site/i18n/locales/en.json | 5 +- .../pages/en/download/package-manager/all.md | 78 ++++++++++++------- apps/site/types/release.ts | 8 +- apps/site/util/downloadUtils.ts | 5 ++ apps/site/util/getNodeDownloadSnippet.ts | 21 ++++- 7 files changed, 107 insertions(+), 33 deletions(-) create mode 100644 apps/site/components/Icons/Platform/Proto.tsx diff --git a/apps/site/components/Downloads/Release/PlatformDropdown.tsx b/apps/site/components/Downloads/Release/PlatformDropdown.tsx index a4839ae966f42..7c477f1bb44d2 100644 --- a/apps/site/components/Downloads/Release/PlatformDropdown.tsx +++ b/apps/site/components/Downloads/Release/PlatformDropdown.tsx @@ -1,7 +1,7 @@ 'use client'; import { useTranslations } from 'next-intl'; -import { useContext, useEffect, useMemo } from 'react'; import type { FC } from 'react'; +import { useContext, useEffect, useMemo } from 'react'; import Select from '@/components/Common/Select'; import Choco from '@/components/Icons/Platform/Choco'; @@ -9,6 +9,7 @@ import Docker from '@/components/Icons/Platform/Docker'; import FNM from '@/components/Icons/Platform/FNM'; import Homebrew from '@/components/Icons/Platform/Homebrew'; import NVM from '@/components/Icons/Platform/NVM'; +import Proto from '@/components/Icons/Platform/Proto'; import { ReleaseContext } from '@/providers/releaseProvider'; import type { PackageManager } from '@/types/release'; import { formatDropdownItems, platformItems } from '@/util/downloadUtils'; @@ -73,6 +74,7 @@ const PlatformDropdown: FC = () => { BREW: , DOCKER: , CHOCO: , + PROTO: , }, disabledItems, })} diff --git a/apps/site/components/Icons/Platform/Proto.tsx b/apps/site/components/Icons/Platform/Proto.tsx new file mode 100644 index 0000000000000..67d71dd6e8a72 --- /dev/null +++ b/apps/site/components/Icons/Platform/Proto.tsx @@ -0,0 +1,19 @@ +import type { FC, SVGProps } from 'react'; + +const Proto: FC> = props => ( + + Proto + + +); + +export default Proto; diff --git a/apps/site/i18n/locales/en.json b/apps/site/i18n/locales/en.json index 8b20d7964f6ef..680c6eb9885dd 100644 --- a/apps/site/i18n/locales/en.json +++ b/apps/site/i18n/locales/en.json @@ -304,7 +304,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", @@ -313,7 +313,8 @@ "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" + "chocolateyNotMaintanedByNodejs": "Chocolatey is not officially maintained by the Node.js project and might not support the {version} version of Node.js", + "protoInstructions": "Follow official instructions at https://moonrepo.dev/docs/proto/install" } } } diff --git a/apps/site/pages/en/download/package-manager/all.md b/apps/site/pages/en/download/package-manager/all.md index 3feb29f9c26ad..ee01cc44572e0 100644 --- a/apps/site/pages/en/download/package-manager/all.md +++ b/apps/site/pages/en/download/package-manager/all.md @@ -9,31 +9,40 @@ title: Installing Node.js via package manager --- -- [Alpine Linux](#alpine-linux) -- [Android](#android) -- [Arch Linux](#arch-linux) -- [CentOS, Fedora and Red Hat Enterprise Linux](#centos-fedora-and-red-hat-enterprise-linux) -- [Debian and Ubuntu based Linux distributions](#debian-and-ubuntu-based-linux-distributions) -- [Exherbo Linux](#exherbo-linux) -- [fnm](#fnm) -- [FreeBSD](#freebsd) -- [Gentoo](#gentoo) -- [IBM i](#ibm-i) -- [macOS](#macos) -- [n](#n) -- [NetBSD](#netbsd) -- [Nodenv](#nodenv) -- [nvm](#nvm) -- [nvs](#nvs) -- [OpenBSD](#openbsd) -- [openSUSE and SLE](#opensuse-and-sle) -- [SmartOS and illumos](#smartos-and-illumos) -- [Snap](#snap) -- [Solus](#solus) -- [vfox](#vfox) -- [Void Linux](#void-linux) -- [Windows](#windows-1) -- [z/OS](#zos) +- [Installing Node.js via Package Managers](#installing-nodejs-via-package-managers) + - [Alpine Linux](#alpine-linux) + - [Android](#android) + - [Arch Linux](#arch-linux) + - [CentOS, Fedora and Red Hat Enterprise Linux](#centos-fedora-and-red-hat-enterprise-linux) + - [Alternatives](#alternatives) + - [Debian and Ubuntu based Linux distributions](#debian-and-ubuntu-based-linux-distributions) + - [Alternatives](#alternatives-1) + - [Exherbo Linux](#exherbo-linux) + - [fnm](#fnm) + - [FreeBSD](#freebsd) + - [Gentoo](#gentoo) + - [IBM i](#ibm-i) + - [macOS](#macos) + - [Alternatives](#alternatives-2) + - [n](#n) + - [NetBSD](#netbsd) + - [Nodenv](#nodenv) + - [nvm](#nvm) + - [nvs](#nvs) + - [Windows](#windows) + - [macOS,UnixLike](#macosunixlike) + - [Usage](#usage) + - [OpenBSD](#openbsd) + - [openSUSE and SLE](#opensuse-and-sle) + - [proto](#proto) + - [SmartOS and illumos](#smartos-and-illumos) + - [Snap](#snap) + - [Solus](#solus) + - [vfox](#vfox) + - [Void Linux](#void-linux) + - [Windows](#windows-1) + - [Alternatives](#alternatives-3) + - [z/OS](#zos) --- @@ -96,7 +105,7 @@ dnf module install nodejs:18/common These resources provide packages compatible with CentOS, Fedora, and RHEL. -- [Node.js snaps](#snap) maintained and supported at https://github.com/nodejs/snap +- [Node.js snaps](#snap) maintained and supported at - [Node.js binary distributions](#debian-and-ubuntu-based-linux-distributions) maintained and supported by [NodeSource](https://github.com/nodesource/distributions) ## Debian and Ubuntu based Linux distributions @@ -344,6 +353,23 @@ zypper install nodejs14 Different major versions of Node can be installed and used concurrently. +## proto + +[proto](https://moonrepo.dev/proto) is a pluggable version manager, a unified toolchain. [proto](https://moonrepo.dev/proto) was designed to be a modern and holistic version manager for all of your favorite programming languages. Supports Bun, Deno, Node (npm, pnpm, yarn), Rust, Go, and more. + +Here's how to install Node.js using [proto](https://moonrepo.dev/proto): + +```bash +# LTS +proto install node lts +# Current +proto install node +# Specific version +proto install node 18.20.4 +``` + +Read the [documentation](https://moonrepo.dev/docs/proto) for more information. + ## SmartOS and illumos SmartOS images come with pkgsrc pre-installed. On other illumos distributions, first install **[pkgsrc](https://pkgsrc.joyent.com/install-on-illumos/)**, then you may install the binary package as normal: diff --git a/apps/site/types/release.ts b/apps/site/types/release.ts index b1e794e940c8c..25c864b0009fd 100644 --- a/apps/site/types/release.ts +++ b/apps/site/types/release.ts @@ -3,7 +3,13 @@ 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' + | 'CHOCO' + | 'PROTO'; export interface ReleaseState { os: UserOS; diff --git a/apps/site/util/downloadUtils.ts b/apps/site/util/downloadUtils.ts index 9a63c751a10e7..58e22472173f9 100644 --- a/apps/site/util/downloadUtils.ts +++ b/apps/site/util/downloadUtils.ts @@ -15,6 +15,7 @@ export enum PackageManagerLabel { BREW = 'Brew', CHOCO = 'Chocolatey', DOCKER = 'Docker', + PROTO = 'Proto', } export const operatingSystemItems = [ @@ -57,6 +58,10 @@ export const platformItems = [ label: PackageManagerLabel.DOCKER, value: 'DOCKER' as PackageManager, }, + { + label: PackageManagerLabel.PROTO, + value: 'PROTO' as PackageManager, + }, ]; export const bitnessItems = { diff --git a/apps/site/util/getNodeDownloadSnippet.ts b/apps/site/util/getNodeDownloadSnippet.ts index a509ebcc558aa..f3e9b8bc62bda 100644 --- a/apps/site/util/getNodeDownloadSnippet.ts +++ b/apps/site/util/getNodeDownloadSnippet.ts @@ -16,13 +16,14 @@ export const getNodeDownloadSnippet = ( BREW: '', DOCKER: '', CHOCO: '', + PROTO: '', }; if (os === 'WIN' || os === 'MAC' || os === 'LINUX') { 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')} @@ -34,6 +35,20 @@ export const getNodeDownloadSnippet = ( # ${t('layouts.download.codeBox.verifiesRightNpmVersion')} docker run node:${release.major}-${release.major >= 4 ? 'alpine' : 'slim'} npm -v # ${t('layouts.download.codeBox.shouldPrint', { version: release.npm })}`; + + snippets.PROTO = dedent` + # ${t('layouts.download.codeBox.noteWithColon')} + # ${t('layouts.download.codeBox.PleaseEnsureAlreadyInstallOnSystem')} + # ${t('layouts.download.codeBox.protoInstructions')} + + # ${t('layouts.download.codeBox.downloadAndInstallNodejs')} + proto install node ${release.major} + + # ${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 })}`; } if (os === 'MAC' || os === 'LINUX') { @@ -69,7 +84,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 })} @@ -103,7 +118,7 @@ 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 })}