Skip to content

Commit 5b828c9

Browse files
committed
Remove Active/Maintenance LTS distinction
1 parent 69cc705 commit 5b828c9

File tree

11 files changed

+35
-68
lines changed

11 files changed

+35
-68
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@ import {
1010
ReleasesContext,
1111
} from '#site/providers/releaseProvider';
1212

13+
import type { NodeReleaseStatus } from '#site/types/releases.js';
1314
import type { FC } from 'react';
1415

15-
const getDropDownStatus = (version: string, status: string) => {
16-
if (status.endsWith('LTS')) {
16+
const getDropDownStatus = (version: string, status: NodeReleaseStatus) => {
17+
if (status === 'LTS') {
1718
return `${version} (LTS)`;
1819
}
1920

2021
if (status === 'Current') {
2122
return `${version} (Current)`;
2223
}
2324

25+
if (status === 'End-of-life') {
26+
return `${version} (EoL)`;
27+
}
28+
2429
return version;
2530
};
2631

@@ -38,7 +43,7 @@ const VersionDropdown: FC = () => {
3843
({ versionWithPrefix }) => versionWithPrefix === version
3944
);
4045

41-
if (release?.isLts && pathname.includes('current')) {
46+
if (release?.status === 'LTS' && pathname.includes('current')) {
4247
redirect({ href: '/download', locale });
4348
return;
4449
}

apps/site/components/Releases/PreviousReleasesTable/TableBody.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ import ReleaseModal from '../ReleaseModal';
1515

1616
const BADGE_KIND_MAP = {
1717
'End-of-life': 'warning',
18-
'Maintenance LTS': 'neutral',
19-
'Active LTS': 'info',
18+
LTS: 'info',
2019
Current: 'default',
21-
Pending: 'default',
2220
} as const;
2321

2422
type PreviousReleasesTableBodyProps = {
@@ -50,7 +48,7 @@ const PreviousReleasesTableBody: FC<PreviousReleasesTableBodyProps> = ({
5048
<td
5149
data-label={t('components.downloadReleasesTable.firstReleased')}
5250
>
53-
<FormattedTime date={release.currentStart} />
51+
<FormattedTime date={release.initialDate} />
5452
</td>
5553

5654
<td data-label={t('components.downloadReleasesTable.lastUpdated')}>

apps/site/components/Releases/ReleaseOverview/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const ReleaseOverview: FC<ReleaseOverviewProps> = ({ release }) => {
2828
<div className={styles.container}>
2929
<ReleaseOverviewItem
3030
Icon={CalendarIcon}
31-
title={<FormattedTime date={release.currentStart} />}
31+
title={<FormattedTime date={release.initialDate} />}
3232
subtitle={t('components.releaseOverview.firstReleased')}
3333
/>
3434

apps/site/components/withDownloadSection.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ const WithDownloadSection: FC<WithDownloadSectionProps> = async ({
3939
.concat(localeSnippets);
4040

4141
// Decides which initial release to use based on the current pathname
42-
const initialRelease = pathname.endsWith('/current')
43-
? 'Current'
44-
: ['Active LTS' as const, 'Maintenance LTS' as const];
42+
const initialRelease = pathname.endsWith('/current') ? 'Current' : 'LTS';
4543

4644
return (
4745
<WithNodeRelease status={initialRelease}>

apps/site/components/withFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const WithFooter: FC = () => {
2727

2828
const primary = (
2929
<div className="flex flex-row gap-2">
30-
<WithNodeRelease status={['Active LTS', 'Maintenance LTS']}>
30+
<WithNodeRelease status="LTS">
3131
{({ release }) => (
3232
<BadgeGroup
3333
size="small"

apps/site/components/withReleaseAlertBox.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ const WithReleaseAlertBox: FC<WithReleaseAlertBoxProps> = ({ status }) => {
2626
})}
2727
</AlertBox>
2828
);
29-
case 'Active LTS':
30-
case 'Maintenance LTS':
29+
case 'LTS':
3130
return (
3231
<AlertBox
3332
title={t('components.common.alertBox.info')}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ describe('generateReleaseData', () => {
4242
version: '14.0.0',
4343
versionWithPrefix: 'v14.0.0',
4444
codename: '',
45-
isLts: false,
4645
npm: '6.14.10',
4746
v8: '8.0.276.20',
4847
releaseDate: '2021-04-20',
48+
initialDate: '2021-04-20',
4949
modules: '83',
5050
status: 'End-of-life',
5151
});

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

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,18 @@
33
import getMajorNodeReleases from './majorNodeReleases.mjs';
44

55
// Gets the appropriate release status for each major release
6-
const getNodeReleaseStatus = (latest, support) => {
6+
const getNodeReleaseStatus = (latest, eol) => {
77
const now = new Date();
8-
const { endOfLife, maintenanceStart, ltsStart, currentStart } = support;
98

10-
if (endOfLife && now >= new Date(endOfLife)) {
9+
if (eol && now >= new Date(eol)) {
1110
return 'End-of-life';
1211
}
1312

14-
if (
15-
latest.lts.isLts &&
16-
maintenanceStart &&
17-
now >= new Date(maintenanceStart)
18-
) {
19-
return 'Maintenance LTS';
13+
if (latest.lts.isLts) {
14+
return 'LTS';
2015
}
2116

22-
if (latest.lts.isLts && ltsStart && now >= new Date(ltsStart)) {
23-
return 'Active LTS';
24-
}
25-
26-
if (currentStart && now >= new Date(currentStart)) {
27-
return 'Current';
28-
}
29-
30-
return 'Pending';
17+
return 'Current';
3118
};
3219

3320
/**
@@ -40,17 +27,15 @@ const generateReleaseData = async () => {
4027
const majors = await getMajorNodeReleases();
4128

4229
return majors.map(([, major]) => {
43-
const [latestVersion] = Object.values(major.releases);
44-
45-
const support = {
46-
currentStart: major.support.phases.dates.start,
47-
ltsStart: major.support.phases.dates.lts,
48-
maintenanceStart: major.support.phases.dates.maintenance,
49-
endOfLife: major.support.phases.dates.end,
50-
};
30+
const versions = Object.values(major.releases);
31+
const latestVersion = versions[0];
32+
const initialVersion = versions[versions.length - 1];
5133

5234
// Get the major release status based on our Release Schedule
53-
const status = getNodeReleaseStatus(latestVersion, support);
35+
const status = getNodeReleaseStatus(
36+
latestVersion,
37+
major.support.phases.dates.end
38+
);
5439

5540
const minorVersions = Object.entries(major.releases).map(([, release]) => ({
5641
modules: release.modules.version || '',
@@ -62,16 +47,15 @@ const generateReleaseData = async () => {
6247
}));
6348

6449
return {
65-
...support,
6650
status,
6751
major: latestVersion.semver.major,
6852
version: latestVersion.semver.raw,
6953
versionWithPrefix: `v${latestVersion.semver.raw}`,
7054
codename: major.support.codename || '',
71-
isLts: status.endsWith('LTS'),
7255
npm: latestVersion.dependencies.npm || '',
7356
v8: latestVersion.dependencies.v8,
7457
releaseDate: latestVersion.releaseDate,
58+
initialDate: initialVersion.releaseDate,
7559
modules: latestVersion.modules.version || '',
7660
minorVersions,
7761
};

apps/site/scripts/orama-search/get-documents.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@ const fetchOptions = process.env.GITHUB_TOKEN
1313

1414
/**
1515
* Fetch Node.js API documentation directly from GitHub
16-
* for the current Active LTS version.
16+
* for the current LTS version.
1717
*/
1818
export const getAPIDocs = async () => {
1919
// Find the current Active LTS version
2020
const releaseData = await generateReleaseData();
21-
const ltsRelease =
22-
releaseData.find(r => r.status === 'Active LTS') ||
23-
releaseData.find(r => r.status === 'Maintenance LTS');
21+
const ltsRelease = releaseData.find(r => r.status === 'LTS');
2422

2523
if (!ltsRelease) {
26-
throw new Error('No Active LTS or Maintenance LTS release found');
24+
throw new Error('No LTS release found');
2725
}
2826

2927
// Get list of API docs from the Node.js repo

apps/site/types/releases.ts

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

83
export type NodeReleaseSource = {
94
major: number;
105
version: string;
116
codename?: string;
12-
currentStart: string;
13-
ltsStart?: string;
14-
maintenanceStart?: string;
15-
endOfLife: string;
167
npm?: string;
178
v8: string;
189
releaseDate: string;
10+
initialDate: string;
1911
modules?: string;
2012
};
2113

@@ -30,7 +22,6 @@ export type MinorVersion = {
3022

3123
export type NodeRelease = {
3224
versionWithPrefix: string;
33-
isLts: boolean;
3425
status: NodeReleaseStatus;
3526
minorVersions: Array<MinorVersion>;
3627
} & NodeReleaseSource;

0 commit comments

Comments
 (0)