Skip to content

Commit 2d1b54a

Browse files
authored
fix: proper release status (#6603)
1 parent 8997b99 commit 2d1b54a

File tree

9 files changed

+17
-31
lines changed

9 files changed

+17
-31
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const getPathnameForApiFile = (name: string, version: string) =>
1616
export const GET = async () => {
1717
const releases = provideReleaseData();
1818

19-
const { versionWithPrefix } = releases.find(release =>
20-
['Active LTS', 'Maintenance LTS'].includes(release.status)
19+
const { versionWithPrefix } = releases.find(
20+
release => release.status === 'LTS'
2121
)!;
2222

2323
const gitHubApiResponse = await fetch(getGitHubApiDocsUrl(versionWithPrefix));

components/Downloads/DownloadButton/index.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const Default: Story = {
1212
ltsStart: '2023-10-24',
1313
maintenanceStart: '2024-10-22',
1414
endOfLife: '2026-04-30',
15-
status: 'Active LTS',
15+
status: 'LTS',
1616
major: 20,
1717
version: '20.11.0',
1818
versionWithPrefix: 'v20.11.0',

components/Downloads/Release/PlatformDropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ReleaseContext } from '@/providers/releaseProvider';
1313
import type { PackageManager } from '@/types/release';
1414
import { formatDropdownItems, platformItems } from '@/util/downloadUtils';
1515

16-
const supportedHomebrewVersions = ['Active LTS', 'Maintenance LTS', 'Current'];
16+
const supportedHomebrewVersions = ['LTS', 'Current'];
1717

1818
const PlatformDropdown: FC = () => {
1919
const { release, os, platform, setPlatform } = useContext(ReleaseContext);

components/Downloads/Release/VersionDropdown.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ import Select from '@/components/Common/Select';
88
import { ReleaseContext } from '@/providers/releaseProvider';
99

1010
const getDropDownStatus = (version: string, status: string) => {
11-
if (status === 'Active LTS') {
11+
if (status === 'LTS') {
1212
return `${version} (LTS)`;
1313
}
1414

1515
if (status === 'Current') {
1616
return `${version} (Current)`;
1717
}
1818

19-
if (status === 'Maintenance') {
20-
return `${version} (Maintenance)`;
21-
}
22-
2319
return version;
2420
};
2521

components/withDownloadCategories.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const WithDownloadCategories: FC<PropsWithChildren> = async ({ children }) => {
1616
const { pathname } = useClientContext();
1717
const { page, category, subCategory } = getDownloadCategory(pathname);
1818

19-
const initialRelease: Array<NodeReleaseStatus> = pathname.includes('current')
20-
? ['Current', 'Maintenance']
21-
: ['Active LTS', 'Maintenance LTS'];
19+
const initialRelease: NodeReleaseStatus = pathname.includes('current')
20+
? 'Current'
21+
: 'LTS';
2222

2323
return (
2424
<LinkTabs

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ describe('generateReleaseData', () => {
4848
expect(release.v8).toBe('8.0.276.20');
4949
expect(release.releaseDate).toBe('2021-04-20');
5050
expect(release.modules).toBe('83');
51-
expect(release.status).toBe('Maintenance LTS');
51+
expect(release.status).toBe('LTS');
5252
});
5353
});

next-data/generators/releaseData.mjs

+5-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@ import nodevu from '@nodevu/core';
44

55
// Gets the appropriate release status for each major release
66
const getNodeReleaseStatus = (now, support) => {
7-
const { endOfLife, maintenanceStart, ltsStart, currentStart } = support;
7+
const { endOfLife, ltsStart, currentStart } = support;
88

9-
if (endOfLife && now > new Date(endOfLife)) {
9+
if (endOfLife && now >= new Date(endOfLife)) {
1010
return 'End-of-life';
1111
}
1212

13-
if (maintenanceStart && now > new Date(maintenanceStart)) {
14-
return ltsStart ? 'Maintenance LTS' : 'Maintenance';
15-
}
16-
17-
if (ltsStart && now > new Date(ltsStart)) {
18-
return 'Active LTS';
13+
if (ltsStart && now >= new Date(ltsStart)) {
14+
return 'LTS';
1915
}
2016

2117
if (currentStart && now >= new Date(currentStart)) {
@@ -58,7 +54,7 @@ const generateReleaseData = () => {
5854
version: latestVersion.semver.raw,
5955
versionWithPrefix: `v${latestVersion.semver.raw}`,
6056
codename: major.support.codename || '',
61-
isLts: status === 'Active LTS' || status === 'Maintenance LTS',
57+
isLts: status === 'LTS',
6258
npm: latestVersion.dependencies.npm || '',
6359
v8: latestVersion.dependencies.v8 || '',
6460
releaseDate: latestVersion.releaseDate || '',

pages/en/index.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ layout: home
1616
</div>
1717

1818
<div>
19-
<WithNodeRelease status={['Active LTS', 'Maintenance LTS']}>
19+
<WithNodeRelease status={['LTS']}>
2020
{({ release }) => (
2121
<>
2222
<DownloadButton release={release}>Download Node.js (LTS)</DownloadButton>
@@ -28,7 +28,7 @@ layout: home
2828
</>
2929
)}
3030
</WithNodeRelease>
31-
<WithNodeRelease status={["Current", "Maintenance"]}>
31+
<WithNodeRelease status={['Current']}>
3232
{({ release }) => (
3333
<small>
3434
Want new features sooner?

types/releases.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
export type NodeReleaseStatus =
2-
| 'Maintenance LTS'
3-
| 'Maintenance'
4-
| 'Active LTS'
5-
| 'Current'
6-
| 'End-of-life'
7-
| 'Pending';
1+
export type NodeReleaseStatus = 'LTS' | 'Current' | 'End-of-life' | 'Pending';
82

93
export interface NodeReleaseSource {
104
major: number;

0 commit comments

Comments
 (0)