Skip to content

Commit

Permalink
docs: Add WinGet as a listed way to install Node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cinderblock committed Jul 31, 2024
1 parent 01ffa2a commit 341072c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/site/components/Downloads/Release/PlatformDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -72,6 +73,7 @@ const PlatformDropdown: FC = () => {
FNM: <FNM width={16} height={16} />,
BREW: <Homebrew width={16} height={16} />,
DOCKER: <Docker width={16} height={16} />,
WINGET: <WinGet width={16} height={16} />,
CHOCO: <Choco width={16} height={16} />,
},
disabledItems,
Expand Down
8 changes: 8 additions & 0 deletions apps/site/components/Icons/Platform/WinGet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { FC, SVGProps } from 'react';

const WinGet: FC<SVGProps<SVGSVGElement>> = props => (
// Use an image to this png for now: https://raw.githubusercontent.com/microsoft/winget-cli/master/.github/images/WindowsPackageManager_Assets/ICO/PNG/_32.png
<image src="https://raw.githubusercontent.com/microsoft/winget-cli/master/.github/images/WindowsPackageManager_Assets/ICO/PNG/_32.png" alt="WinGet" {...props} />
);

export default WinGet;
3 changes: 3 additions & 0 deletions apps/site/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion apps/site/types/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions apps/site/util/downloadUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export const platformItems = [
label: PackageManagerLabel.BREW,
value: 'BREW' as PackageManager,
},
{
label: PackageManagerLabel.WINGET,
value: 'WINGET' as PackageManager,
},
{
label: PackageManagerLabel.CHOCO,
value: 'CHOCO' as PackageManager,
Expand Down
17 changes: 17 additions & 0 deletions apps/site/util/getNodeDownloadSnippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const getNodeDownloadSnippet = (
FNM: '',
BREW: '',
DOCKER: '',
WINGET: '',
CHOCO: '',
};

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

snippets.FNM = dedent`
# ${t('layouts.download.codeBox.installsFnm')}
winget install Schniz.fnm
Expand Down

0 comments on commit 341072c

Please sign in to comment.