Skip to content

Commit 6deaf66

Browse files
authored
fix: check latest release LTS status for version support (nodejs#8787)
1 parent ece12b2 commit 6deaf66

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

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

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

910
if (endOfLife && now >= new Date(endOfLife)) {
1011
return 'End-of-life';
1112
}
1213

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

17-
if (ltsStart && now >= new Date(ltsStart)) {
22+
if (latest.lts.isLts && ltsStart && now >= new Date(ltsStart)) {
1823
return 'Active LTS';
1924
}
2025

@@ -45,7 +50,7 @@ const generateReleaseData = async () => {
4550
};
4651

4752
// Get the major release status based on our Release Schedule
48-
const status = getNodeReleaseStatus(new Date(), support);
53+
const status = getNodeReleaseStatus(latestVersion, support);
4954

5055
const minorVersions = Object.entries(major.releases).map(([, release]) => ({
5156
modules: release.modules.version || '',

0 commit comments

Comments
 (0)