Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions apps/site/components/Releases/ReleaseSchedule/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { create } from 'lts';

import provideReleaseSchedule from '#site/next-data/providers/releaseSchedule';

import type { FC } from 'react';

const MONTH = 30 * 24 * 3_600_000;

const ReleaseSchedule: FC = async () => {
const schedule = await provideReleaseSchedule();

const now = Date.now();

Check warning on line 12 in apps/site/components/Releases/ReleaseSchedule/index.tsx

View workflow job for this annotation

GitHub Actions / Quality checks

Do not call 'Date.now()' during render. Components and hooks must be pure. Move this call into an event handler, effect, or state initializer

const threeMonthsAgo = new Date(now - 3 * MONTH);

Check warning on line 14 in apps/site/components/Releases/ReleaseSchedule/index.tsx

View workflow job for this annotation

GitHub Actions / Quality checks

Do not call 'new Date(now - 3 * MONTH)' during render. Components and hooks must be pure. Move this call into an event handler, effect, or state initializer
const sixMonthsFromNow = new Date(now + 6 * MONTH);

Check warning on line 15 in apps/site/components/Releases/ReleaseSchedule/index.tsx

View workflow job for this annotation

GitHub Actions / Quality checks

Do not call 'new Date(now + 6 * MONTH)' during render. Components and hooks must be pure. Move this call into an event handler, effect, or state initializer

const svg = create({
data: schedule,
queryStart: threeMonthsAgo,
queryEnd: sixMonthsFromNow,
animate: true,
excludeMain: false,
projectName: 'Node.js',
currentDateMarker: 'red',
});

return (
<div
dangerouslySetInnerHTML={{ __html: svg.html() }}

Check warning on line 29 in apps/site/components/Releases/ReleaseSchedule/index.tsx

View workflow job for this annotation

GitHub Actions / Quality checks

Using 'dangerouslySetInnerHTML' may have security implications
className="h-auto w-auto"
/>
);
};

export default ReleaseSchedule;
2 changes: 2 additions & 0 deletions apps/site/mdx/components.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import MDXImage from '#site/components/MDX/Image';
import MinorReleasesTable from '#site/components/Releases/MinorReleasesTable';
import PreviousReleasesTable from '#site/components/Releases/PreviousReleasesTable';
import ReleaseOverview from '#site/components/Releases/ReleaseOverview';
import ReleaseSchedule from '#site/components/Releases/ReleaseSchedule';
import WithBadgeGroup from '#site/components/withBadgeGroup';
import WithBanner from '#site/components/withBanner';
import WithDownloadArchive from '#site/components/withDownloadArchive';
Expand Down Expand Up @@ -96,6 +97,7 @@ export default {
BadgeGroup,
ReleaseOverview,
MinorReleasesTable,
ReleaseSchedule,
UpcomingMeetings,
EOLAlertBox,
EOLReleaseTable,
Expand Down
10 changes: 10 additions & 0 deletions apps/site/next-data/generators/releaseSchedule.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { RELEASE_SCHEDULE_URL } from '#site/next.constants.mjs';
import { fetchWithRetry } from '#site/next.fetch.mjs';

async function fetchReleaseSchedule() {
const response = await fetchWithRetry(RELEASE_SCHEDULE_URL);

return response.json();
}

export default fetchReleaseSchedule;
5 changes: 5 additions & 0 deletions apps/site/next-data/providers/releaseSchedule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { cache } from 'react';

import generateReleaseSchdule from '#site/next-data/generators/releaseSchedule.mjs';

export default cache(generateReleaseSchdule);
6 changes: 6 additions & 0 deletions apps/site/next.constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,9 @@ export const VULNERABILITIES_URL =
*/
export const OPENCOLLECTIVE_MEMBERS_URL =
'https://opencollective.com/nodejs/members/all.json';

/**
* The location of the Node.js release schedule JSON.
*/
export const RELEASE_SCHEDULE_URL =
'https://raw.githubusercontent.com/nodejs/Release/refs/heads/main/schedule.json';
1 change: 1 addition & 0 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"feed": "~5.2.0",
"github-slugger": "~2.0.0",
"gray-matter": "~4.0.3",
"lts": "github:araujogui/lts-schedule#refactor-website",
"mdast-util-to-string": "^4.0.0",
"next": "16.1.7",
"next-intl": "~4.8.3",
Expand Down
2 changes: 1 addition & 1 deletion apps/site/pages/en/about/previous-releases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Production applications should only use _Active LTS_ or _Maintenance LTS_ releas

## Release Schedule

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

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

Expand Down
Loading
Loading