Skip to content

Commit 20fb2d7

Browse files
committed
docs: Add WinGet as a listed way to install Node.js
1 parent 01ffa2a commit 20fb2d7

File tree

6 files changed

+49
-1
lines changed

6 files changed

+49
-1
lines changed

apps/site/components/Downloads/Release/PlatformDropdown.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useContext, useEffect, useMemo } from 'react';
44
import type { FC } from 'react';
55

66
import Select from '@/components/Common/Select';
7+
import WinGet from '@/components/Icons/Platform/WinGet';
78
import Choco from '@/components/Icons/Platform/Choco';
89
import Docker from '@/components/Icons/Platform/Docker';
910
import FNM from '@/components/Icons/Platform/FNM';
@@ -68,6 +69,7 @@ const PlatformDropdown: FC = () => {
6869
values={formatDropdownItems({
6970
items: platformItems,
7071
icons: {
72+
WINGET: <WinGet width={16} height={16} />,
7173
NVM: <NVM width={16} height={16} />,
7274
FNM: <FNM width={16} height={16} />,
7375
BREW: <Homebrew width={16} height={16} />,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { FC, SVGProps } from 'react';
2+
3+
const WinGet: FC<SVGProps<SVGSVGElement>> = props => (
4+
// TODO: Use real svg for WinGet: https://github.com/microsoft/winget-cli/issues/4691
5+
// For now, the Windows logo is used as a placeholder
6+
<svg
7+
width="32"
8+
height="32"
9+
viewBox="0 0 32 32"
10+
fill="none"
11+
xmlns="http://www.w3.org/2000/svg"
12+
{...props}
13+
>
14+
<path fill="#FEBA08" d="M17 17h10v10H17z" />
15+
<path fill="#05A6F0" d="M5 17h10v10H5z" />
16+
<path fill="#80BC06" d="M17 5h10v10H17z" />
17+
<path fill="#F25325" d="M5 5h10v10H5z" />
18+
</svg>
19+
);
20+
21+
export default WinGet;

apps/site/i18n/locales/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@
310310
"homebrewIsNotNodejsPackageManager": "Homebrew is not a Node.js package manager.",
311311
"homebrewInstructions": "Follow official instructions at https://brew.sh/",
312312
"homebrewSupportsIntallingMajorNodejsVersion": "Homebrew only supports installing major Node.js versions and might not support the latest Node.js version from the {version} release line.",
313+
"wingetIsNotNodejsPackageManager": "The Windows Package Manager is not a Node.js package manager.",
314+
"wingetInstructions": "Follow official instructions at https://learn.microsoft.com/en-us/windows/package-manager/winget/install",
315+
"wingetNotMaintainedByNodejs": "WinGet is not officially maintained by the Node.js project and might not support the {version} version of Node.js",
313316
"chocolateyIsNotNodejsPackageManager": "Chocolatey is not a Node.js package manager.",
314317
"chocolateyInstructions": "Follow official instructions at https://chocolatey.org/",
315318
"chocolateyNotMaintainedByNodejs": "Chocolatey is not officially maintained by the Node.js project and might not support the {version} version of Node.js"

apps/site/types/release.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ReactNode } from 'react';
33
import type { NodeRelease } from '@/types/releases';
44
import type { UserOS } from '@/types/userOS';
55

6-
export type PackageManager = 'NVM' | 'FNM' | 'BREW' | 'DOCKER' | 'CHOCO';
6+
export type PackageManager = 'NVM' | 'FNM' | 'BREW' | 'DOCKER' | 'WINGET' | 'CHOCO';
77

88
export interface ReleaseState {
99
os: UserOS;

apps/site/util/downloadUtils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export enum PackageManagerLabel {
1313
NVM = 'nvm',
1414
FNM = 'fnm',
1515
BREW = 'Brew',
16+
WINGET = 'WinGet',
1617
CHOCO = 'Chocolatey',
1718
DOCKER = 'Docker',
1819
}
@@ -49,6 +50,10 @@ export const platformItems = [
4950
label: PackageManagerLabel.BREW,
5051
value: 'BREW' as PackageManager,
5152
},
53+
{
54+
label: PackageManagerLabel.WINGET,
55+
value: 'WINGET' as PackageManager,
56+
},
5257
{
5358
label: PackageManagerLabel.CHOCO,
5459
value: 'CHOCO' as PackageManager,

apps/site/util/getNodeDownloadSnippet.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const getNodeDownloadSnippet = (
1515
FNM: '',
1616
BREW: '',
1717
DOCKER: '',
18+
WINGET: '',
1819
CHOCO: '',
1920
};
2021

@@ -84,6 +85,22 @@ export const getNodeDownloadSnippet = (
8485
}
8586

8687
if (os === 'WIN') {
88+
snippets.WINGET = dedent`
89+
# ${t('layouts.download.codeBox.noteWithColon')}
90+
# ${t('layouts.download.codeBox.wingetIsNotNodejsPackageManager')}
91+
# ${t('layouts.download.codeBox.PleaseEnsureAlreadyInstallOnSystem')}
92+
# ${t('layouts.download.codeBox.wingetInstructions')}
93+
# ${t('layouts.download.codeBox.wingetNotMaintainedByNodejs', { version: release.versionWithPrefix })}
94+
95+
# ${t('layouts.download.codeBox.downloadAndInstallNodejs')}
96+
winget install -e --id OpenJS.NodeJS${release.isLts ? '.LTS' : ''} -v ${release.version}
97+
98+
# ${t('layouts.download.codeBox.verifiesRightNodejsVersion')}
99+
node -v # ${t('layouts.download.codeBox.shouldPrint', { version: release.versionWithPrefix })}
100+
101+
# ${t('layouts.download.codeBox.verifiesRightNpmVersion')}
102+
npm -v # ${t('layouts.download.codeBox.shouldPrint', { version: release.npm })}`;
103+
87104
snippets.FNM = dedent`
88105
# ${t('layouts.download.codeBox.installsFnm')}
89106
winget install Schniz.fnm

0 commit comments

Comments
 (0)