Skip to content

Commit 48b0ce3

Browse files
committed
feat: create release schedule component
1 parent 8c5a7dd commit 48b0ce3

File tree

9 files changed

+1518
-15
lines changed

9 files changed

+1518
-15
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { create } from 'lts';
2+
3+
import provideReleaseSchedule from '#site/next-data/providers/releaseSchedule';
4+
5+
import type { FC } from 'react';
6+
7+
const ReleaseSchedule: FC = async () => {
8+
const schedule = await provideReleaseSchedule();
9+
10+
const now = new Date();
11+
12+
const threeMonthsAgo = new Date(now);
13+
threeMonthsAgo.setMonth(now.getMonth() - 3);
14+
15+
const sixMonthsFromNow = new Date();
16+
sixMonthsFromNow.setMonth(now.getMonth() + 6);
17+
18+
const svg = create({
19+
data: schedule,
20+
queryStart: threeMonthsAgo,
21+
queryEnd: sixMonthsFromNow,
22+
animate: true,
23+
excludeMain: false,
24+
projectName: 'Node.js',
25+
currentDateMarker: 'red',
26+
});
27+
28+
return (
29+
<div
30+
dangerouslySetInnerHTML={{ __html: svg.html() }}
31+
className="h-auto w-auto"
32+
/>
33+
);
34+
};
35+
36+
export default ReleaseSchedule;

apps/site/mdx/components.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import MDXImage from '#site/components/MDX/Image';
3434
import MinorReleasesTable from '#site/components/Releases/MinorReleasesTable';
3535
import PreviousReleasesTable from '#site/components/Releases/PreviousReleasesTable';
3636
import ReleaseOverview from '#site/components/Releases/ReleaseOverview';
37+
import ReleaseSchedule from '#site/components/Releases/ReleaseSchedule';
3738
import WithBadgeGroup from '#site/components/withBadgeGroup';
3839
import WithBanner from '#site/components/withBanner';
3940
import WithDownloadArchive from '#site/components/withDownloadArchive';
@@ -96,6 +97,7 @@ export default {
9697
BadgeGroup,
9798
ReleaseOverview,
9899
MinorReleasesTable,
100+
ReleaseSchedule,
99101
UpcomingMeetings,
100102
EOLAlertBox,
101103
EOLReleaseTable,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RELEASE_SCHEDULE_URL } from '#site/next.constants.mjs';
2+
import { fetchWithRetry } from '#site/util/fetch';
3+
4+
async function fetchReleaseSchedule() {
5+
const response = await fetchWithRetry(RELEASE_SCHEDULE_URL);
6+
7+
const payload = await response.json();
8+
9+
return payload;
10+
}
11+
12+
export default fetchReleaseSchedule;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { cache } from 'react';
2+
3+
import fetchReleaseSchedule from '#site/next-data/generators/releaseSchedule.mjs';
4+
5+
export default cache(fetchReleaseSchedule);

apps/site/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
33
/// <reference types="next/navigation-types/compat/navigation" />
4-
import './.next/types/routes.d.ts';
4+
import './.next/dev/types/routes.d.ts';
55

66
// NOTE: This file should not be edited
77
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

apps/site/next.constants.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,9 @@ export const VULNERABILITIES_URL =
219219
*/
220220
export const OPENCOLLECTIVE_MEMBERS_URL =
221221
'https://opencollective.com/nodejs/members/all.json';
222+
223+
/**
224+
* The location of the Node.js release schedule JSON.
225+
*/
226+
export const RELEASE_SCHEDULE_URL =
227+
'https://raw.githubusercontent.com/nodejs/Release/refs/heads/main/schedule.json';

apps/site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"feed": "~5.1.0",
5959
"github-slugger": "~2.0.0",
6060
"gray-matter": "~4.0.3",
61+
"lts": "github:araujogui/lts-schedule#refactor-website",
6162
"mdast-util-to-string": "^4.0.0",
6263
"next": "16.0.10",
6364
"next-intl": "~4.5.3",

apps/site/pages/en/about/previous-releases.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Production applications should only use _Active LTS_ or _Maintenance LTS_ releas
1414

1515
## Release Schedule
1616

17-
![Releases](https://raw.githubusercontent.com/nodejs/Release/main/schedule.svg?sanitize=true)
17+
<ReleaseSchedule />
1818

1919
Full details regarding the Node.js release schedule are available [on GitHub](https://github.com/nodejs/release#release-schedule).
2020

0 commit comments

Comments
 (0)