Skip to content

Commit 8475829

Browse files
authored
feat: package-managers as default, redirects and more info (#6720)
* feat: package-managers as default, redirects and more info * chore: fix test * chore: added missing redirect of current --------- Signed-off-by: Claudio W <cwunder@gnome.org>
1 parent c24c693 commit 8475829

File tree

11 files changed

+74
-35
lines changed

11 files changed

+74
-35
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
node_modules
33
npm-debug.log
44
.npm
5-
.env.local
5+
.env.*
66

77
# Next.js Build Output
88
.next

components/Common/Badge/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Badge: FC<PropsWithChildren<BadgeProps>> = ({
1919
<Link className={`${styles.wrapper} ${styles[kind]}`} {...args}>
2020
{badgeText && <span className={styles.badge}>{badgeText}</span>}
2121
<span className={styles.message}>{children}</span>
22-
<ArrowRightIcon className={styles.icon} />
22+
{args.href && <ArrowRightIcon className={styles.icon} />}
2323
</Link>
2424
);
2525

components/Downloads/Release/ReleaseCodeBox.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ const ReleaseCodeBox: FC = () => {
4343
)}
4444

4545
<span className="text-center text-xs text-neutral-800 dark:text-neutral-200">
46-
<b>{t('layouts.download.codeBox.managerInstalled')}</b>
47-
<br />
4846
{t('layouts.download.codeBox.communityWarning')}
47+
<br />
48+
<b>{t('layouts.download.codeBox.communityWarningReport')}</b>
4949
</span>
5050
</div>
5151
);

components/withDownloadCategories.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ const WithDownloadCategories: FC<PropsWithChildren> = async ({ children }) => {
2828
page: page,
2929
categories: [
3030
{
31-
category: 'download',
32-
label: t('layouts.download.categories.download'),
31+
category: 'package-manager',
32+
label: t('layouts.download.categories.package-manager'),
3333
},
3434
{
35-
category: 'prebuilt-binaries',
36-
label: t('layouts.download.categories.prebuilt-binaries'),
35+
category: 'prebuilt-installer',
36+
label: t('layouts.download.categories.prebuilt-installer'),
3737
},
3838
{
39-
category: 'package-manager',
40-
label: t('layouts.download.categories.package-manager'),
39+
category: 'prebuilt-binaries',
40+
label: t('layouts.download.categories.prebuilt-binaries'),
4141
},
4242
{
4343
category: 'source-code',

i18n/locales/en.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
"download": {
269269
"selectCategory": "Categories",
270270
"categories": {
271-
"download": "Prebuilt Installer",
271+
"prebuilt-installer": "Prebuilt Installer",
272272
"prebuilt-binaries": "Prebuilt Binaries",
273273
"package-manager": "Package Manager",
274274
"source-code": "Source Code"
@@ -284,8 +284,9 @@
284284
"platform": "Platform"
285285
},
286286
"codeBox": {
287-
"managerInstalled": "Please ensure you have the right package manager installed before running a script.",
288-
"communityWarning": "Package managers and their installation scripts are not maintained by the Node.js project."
287+
"systemManagerWarning": "is not a Node.js package manager. Please ensure you already have {packageManager} installed.",
288+
"communityWarning": "Package managers and their installation scripts are not maintained by the Node.js project.",
289+
"communityWarningReport": "If you encounter issues, please reach out to the package manager's maintainers."
289290
}
290291
}
291292
}
File renamed without changes.
File renamed without changes.

redirects.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@
271271
{
272272
"source": "/:locale/blog/weekly-updates/:path*",
273273
"destination": "/:locale/blog/weekly/:path*"
274+
},
275+
{
276+
"source": "/:locale/download",
277+
"destination": "/:locale/download/package-manager"
278+
},
279+
{
280+
"source": "/:locale/download/current",
281+
"destination": "/:locale/download/package-manager/current"
274282
}
275283
],
276284
"internal": []

util/__tests__/downloadUtils.test.mjs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ describe('mapCategoriesToTabs', () => {
103103
page: 'download',
104104
categories: [
105105
{
106-
category: 'download',
107-
label: 'Download',
106+
category: 'prebuilt-binaries',
107+
label: 'Prebuilt Binaries',
108108
},
109109
{
110110
category: 'package-manager',
@@ -115,7 +115,11 @@ describe('mapCategoriesToTabs', () => {
115115
});
116116

117117
expect(result).toEqual([
118-
{ key: 'download', label: 'Download', link: '/download/current' },
118+
{
119+
key: 'prebuilt-binaries',
120+
label: 'Prebuilt Binaries',
121+
link: '/download/prebuilt-binaries/current',
122+
},
119123
{
120124
key: 'package-manager',
121125
label: 'Package Manager',
@@ -129,8 +133,8 @@ describe('mapCategoriesToTabs', () => {
129133
page: 'download',
130134
categories: [
131135
{
132-
category: 'download',
133-
label: 'Download',
136+
category: 'prebuilt-binaries',
137+
label: 'Prebuilt Binaries',
134138
},
135139
{
136140
category: 'package-manager',
@@ -140,7 +144,11 @@ describe('mapCategoriesToTabs', () => {
140144
});
141145

142146
expect(result).toEqual([
143-
{ key: 'download', label: 'Download', link: '/download' },
147+
{
148+
key: 'prebuilt-binaries',
149+
label: 'Prebuilt Binaries',
150+
link: '/download/prebuilt-binaries',
151+
},
144152
{
145153
key: 'package-manager',
146154
label: 'Package Manager',

util/downloadUtils.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,60 @@
11
import type { PackageManager } from '@/types/release';
22
import type { UserOS } from '@/types/userOS';
33

4-
// A utility enum to help convert `userOs` data type to user-readable format
5-
export enum OperatingSystem {
4+
export enum OperatingSystemLabel {
65
WIN = 'Windows',
76
MAC = 'macOS',
87
LINUX = 'Linux',
98
AIX = 'AIX',
109
OTHER = 'Other',
1110
}
1211

12+
export enum PackageManagerLabel {
13+
NVM = 'nvm',
14+
FNM = 'fnm',
15+
BREW = 'Brew',
16+
CHOCO = 'Chocolatey',
17+
DOCKER = 'Docker',
18+
}
19+
1320
export const operatingSystemItems = [
1421
{
15-
label: OperatingSystem.WIN,
22+
label: OperatingSystemLabel.WIN,
1623
value: 'WIN' as UserOS,
1724
},
1825
{
19-
label: OperatingSystem.MAC,
26+
label: OperatingSystemLabel.MAC,
2027
value: 'MAC' as UserOS,
2128
},
2229
{
23-
label: OperatingSystem.LINUX,
30+
label: OperatingSystemLabel.LINUX,
2431
value: 'LINUX' as UserOS,
2532
},
2633
{
27-
label: OperatingSystem.AIX,
34+
label: OperatingSystemLabel.AIX,
2835
value: 'AIX' as UserOS,
2936
},
3037
];
3138

3239
export const platformItems = [
3340
{
34-
label: 'nvm',
41+
label: PackageManagerLabel.NVM,
3542
value: 'NVM' as PackageManager,
3643
},
3744
{
38-
label: 'fnm',
45+
label: PackageManagerLabel.FNM,
3946
value: 'FNM' as PackageManager,
4047
},
4148
{
42-
label: 'Brew',
49+
label: PackageManagerLabel.BREW,
4350
value: 'BREW' as PackageManager,
4451
},
4552
{
46-
label: 'Chocolatey',
53+
label: PackageManagerLabel.CHOCO,
4754
value: 'CHOCO' as PackageManager,
4855
},
4956
{
50-
label: 'Docker',
57+
label: PackageManagerLabel.DOCKER,
5158
value: 'DOCKER' as PackageManager,
5259
},
5360
];
@@ -160,8 +167,5 @@ export const mapCategoriesToTabs = ({
160167
categories.map(({ category, label }) => ({
161168
key: category,
162169
label: label,
163-
link:
164-
category === 'download'
165-
? `/${[page, subCategory].filter(Boolean).join('/')}`
166-
: `/${[page, category, subCategory].filter(Boolean).join('/')}`,
170+
link: `/${[page, category, subCategory].filter(Boolean).join('/')}`,
167171
}));

0 commit comments

Comments
 (0)