Skip to content

Commit 306a762

Browse files
avivkellerCopilot
andauthored
fix(release): fix issues with maintenance and active lts (#7979)
* fix(release): fix issues with maintenance and active lts * Update apps/site/app/[locale]/next-data/api-data/route.ts Co-authored-by: Copilot <[email protected]> Signed-off-by: Aviv Keller <[email protected]> * Update apps/site/next-data/generators/releaseData.mjs Co-authored-by: Copilot <[email protected]> Signed-off-by: Aviv Keller <[email protected]> * fixup! --------- Signed-off-by: Aviv Keller <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 5cba6c0 commit 306a762

File tree

10 files changed

+19
-24
lines changed

10 files changed

+19
-24
lines changed

apps/site/app/[locale]/next-data/api-data/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const GET = async () => {
2424
const releases = provideReleaseData();
2525

2626
const { versionWithPrefix } = releases.find(
27-
release => release.status === 'LTS'
27+
release => release.status === 'Active LTS'
2828
)!;
2929

3030
const gitHubApiResponse = await fetch(

apps/site/components/Downloads/DownloadReleasesTable/index.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,12 @@ import getReleaseData from '#site/next-data/releaseData';
88

99
const BADGE_KIND_MAP = {
1010
'End-of-life': 'warning',
11-
Maintenance: 'neutral',
12-
LTS: 'info',
11+
'Maintenance LTS': 'neutral',
12+
'Active LTS': 'info',
1313
Current: 'default',
1414
Pending: 'default',
1515
} as const;
1616

17-
const BADGE_TEXT_MAP = {
18-
'End-of-life': 'End-of-Life (EOL)',
19-
Maintenance: 'Maintenance LTS',
20-
LTS: 'Active LTS',
21-
Current: 'Current',
22-
Pending: 'Pending',
23-
} as const;
24-
2517
const DownloadReleasesTable: FC = async () => {
2618
const releaseData = await getReleaseData();
2719

@@ -52,7 +44,8 @@ const DownloadReleasesTable: FC = async () => {
5244
</td>
5345
<td data-label="Status">
5446
<Badge kind={BADGE_KIND_MAP[release.status]} size="small">
55-
{BADGE_TEXT_MAP[release.status]}
47+
{release.status}
48+
{release.status === 'End-of-life' ? ' (EoL)' : ''}
5649
</Badge>
5750
</td>
5851
<td className="download-table-last">

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const ReleaseCodeBox: FC = () => {
127127
</AlertBox>
128128
)}
129129

130-
{release.status === 'LTS' && (
130+
{release.isLts && (
131131
<AlertBox
132132
title={t('components.common.alertBox.info')}
133133
level="info"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '#site/providers/releaseProvider';
1313

1414
const getDropDownStatus = (version: string, status: string) => {
15-
if (status === 'LTS') {
15+
if (status.endsWith('LTS')) {
1616
return `${version} (LTS)`;
1717
}
1818

@@ -37,7 +37,7 @@ const VersionDropdown: FC = () => {
3737
({ versionWithPrefix }) => versionWithPrefix === version
3838
);
3939

40-
if (release?.status === 'LTS' && pathname.includes('current')) {
40+
if (release?.isLts && pathname.includes('current')) {
4141
redirect({ href: '/download', locale: locale });
4242
return;
4343
}

apps/site/components/Downloads/ReleaseModal/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const ReleaseModal: FC<ReleaseModalProps> = ({
5454
</div>
5555
)}
5656

57-
{release.status === 'LTS' && (
57+
{release.isLts && (
5858
<div className="mb-4">
5959
<AlertBox
6060
title={t('components.common.alertBox.info')}

apps/site/components/withDownloadSection.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ const WithDownloadSection: FC<PropsWithChildren> = async ({ children }) => {
2828
.concat(snippets);
2929

3030
// Decides which initial release to use based on the current pathname
31-
const initialRelease = pathname.endsWith('/current') ? 'Current' : 'LTS';
31+
const initialRelease = pathname.endsWith('/current')
32+
? 'Current'
33+
: 'Active LTS';
3234

3335
return (
3436
<WithNodeRelease status={initialRelease}>

apps/site/next-data/generators/releaseData.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ const getNodeReleaseStatus = (now, support) => {
1212
}
1313

1414
if (maintenanceStart && now >= new Date(maintenanceStart)) {
15-
return 'Maintenance';
15+
return 'Maintenance LTS';
1616
}
1717

1818
if (ltsStart && now >= new Date(ltsStart)) {
19-
return 'LTS';
19+
return 'Active LTS';
2020
}
2121

2222
if (currentStart && now >= new Date(currentStart)) {
@@ -96,7 +96,7 @@ const generateReleaseData = async () => {
9696
version: latestVersion.semver.raw,
9797
versionWithPrefix: `v${latestVersion.semver.raw}`,
9898
codename: major.support.codename || '',
99-
isLts: status === 'LTS',
99+
isLts: status.endsWith('LTS'),
100100
npm: latestVersion.dependencies.npm || '',
101101
v8: latestVersion.dependencies.v8,
102102
releaseDate: latestVersion.releaseDate,

apps/site/pages/en/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ layout: home
2828
</Button>
2929

3030
<div className="flex flex-col xs:flex-row gap-2 justify-center xs:mt-6">
31-
<WithNodeRelease status="LTS">
31+
<WithNodeRelease status="Active LTS">
3232
{({ release }) =>
3333
<BadgeGroup size="small" kind="info" badgeText={release.versionWithPrefix} href={`/blog/release/${release.versionWithPrefix}`}>
3434
Node.js LTS

apps/site/types/releases.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export type NodeReleaseStatus =
2-
| 'LTS'
3-
| 'Maintenance'
2+
| 'Active LTS'
3+
| 'Maintenance LTS'
44
| 'Current'
55
| 'End-of-life'
66
| 'Pending';

apps/site/util/download/constants.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"name": "Brew",
143143
"compatibility": {
144144
"os": ["MAC", "LINUX"],
145-
"releases": ["Current", "LTS"]
145+
"releases": ["Current", "Active LTS", "Maintenance LTS"]
146146
},
147147
"url": "https://brew.sh/",
148148
"info": "layouts.download.codeBox.platformInfo.brew"

0 commit comments

Comments
 (0)