Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docs for Proto package manager #6978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
'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';
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';
Expand Down Expand Up @@ -73,6 +74,7 @@ const PlatformDropdown: FC = () => {
BREW: <Homebrew width={16} height={16} />,
DOCKER: <Docker width={16} height={16} />,
CHOCO: <Choco width={16} height={16} />,
PROTO: <Proto width={16} height={16} />,
},
disabledItems,
})}
Expand Down
19 changes: 19 additions & 0 deletions apps/site/components/Icons/Platform/Proto.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { FC, SVGProps } from 'react';

const Proto: FC<SVGProps<SVGSVGElement>> = props => (
<svg
xmlns="http://www.w3.org/2000/svg"
xmlSpace="preserve"
viewBox="0 0 177 74"
height="90"
{...props}
>
<title>Proto</title>
<path
fill="currentColor"
d="M87.61 16.365c-11.4 0-20.64 9.24-20.64 20.64s9.24 20.64 20.64 20.64 20.64-9.24 20.64-20.64-9.24-20.64-20.64-20.64m0 33.27c-6.98 0-12.63-5.66-12.63-12.63 0-6.98 5.66-12.63 12.63-12.63 6.98 0 12.63 5.66 12.63 12.63 0 6.98-5.66 12.63-12.63 12.63m68.34-33.27c-11.4 0-20.64 9.24-20.64 20.64s9.24 20.64 20.64 20.64 20.64-9.24 20.64-20.64-9.24-20.64-20.64-20.64m0 33.27c-6.98 0-12.63-5.66-12.63-12.63 0-6.98 5.66-12.63 12.63-12.63s12.63 5.66 12.63 12.63c0 6.98-5.66 12.63-12.63 12.63M20.66 16.365c-11.4 0-20.64 9.24-20.64 20.64v36.99h8.01v-20.69c3.49 2.71 7.87 4.34 12.63 4.34 11.4 0 20.64-9.24 20.64-20.64s-9.24-20.64-20.64-20.64m0 33.27c-6.98 0-12.63-5.66-12.63-12.63 0-6.98 5.66-12.63 12.63-12.63 6.98 0 12.63 5.66 12.63 12.63 0 6.98-5.65 12.63-12.63 12.63M121.62.015h-8.01v40.22c0 9.62 7.8 17.41 17.41 17.41v-8.01c-5.19 0-9.4-4.21-9.4-9.4v-19.86h9.4v-8.01h-9.4zm-57.04 16.35c-9.62 0-17.41 7.8-17.41 17.41v23.87h8.01v-23.87c0-5.19 4.21-9.4 9.4-9.4z"
/>
</svg>
);

export default Proto;
5 changes: 3 additions & 2 deletions apps/site/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
}
Expand Down
78 changes: 52 additions & 26 deletions apps/site/pages/en/download/package-manager/all.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

---

Expand Down Expand Up @@ -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 <https://github.com/nodejs/snap>
- [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
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion apps/site/types/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions apps/site/util/downloadUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum PackageManagerLabel {
BREW = 'Brew',
CHOCO = 'Chocolatey',
DOCKER = 'Docker',
PROTO = 'Proto',
}

export const operatingSystemItems = [
Expand Down Expand Up @@ -57,6 +58,10 @@ export const platformItems = [
label: PackageManagerLabel.DOCKER,
value: 'DOCKER' as PackageManager,
},
{
label: PackageManagerLabel.PROTO,
value: 'PROTO' as PackageManager,
},
];

export const bitnessItems = {
Expand Down
21 changes: 18 additions & 3 deletions apps/site/util/getNodeDownloadSnippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')}

Expand All @@ -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') {
Expand Down Expand Up @@ -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 })}

Expand Down Expand Up @@ -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 })}

Expand Down
Loading