Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
13 changes: 11 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ jobs:
# this should be a last resort in case by any chances the build memory gets too high
# but in general this should never happen
NODE_OPTIONS: '--max_old_space_size=4096'
# We want to ensure that static exports for all locales do not occur on `pull_request` events
NEXT_PUBLIC_STATIC_EXPORT_LOCALE: ${{ github.event_name == 'push' }}
# See https://github.com/vercel/next.js/pull/81318
TURBOPACK_STATS: ${{ matrix.os == 'ubuntu-latest' }}

Expand All @@ -77,3 +75,14 @@ jobs:
with:
name: webpack-stats
path: apps/site/.next/server/webpack-stats.json

- name: Build Next.js (Static Default Locale)
# We want to generate a static build, as it is a requirement of our website.
run: node_modules/.bin/turbo deploy ${{ env.TURBO_ARGS }}
env:
# We want to ensure we have enough RAM allocated to the Node.js process
# this should be a last resort in case by any chances the build memory gets too high
# but in general this should never happen
NODE_OPTIONS: '--max_old_space_size=4096'
# We want to ensure that static exports for all locales do not occur on `pull_request` events
NEXT_PUBLIC_STATIC_EXPORT_LOCALE: ${{ github.event_name == 'push' }}
8 changes: 4 additions & 4 deletions apps/site/app/[locale]/download/archive/[version]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export const generateMetadata = basePage.generateMetadata;
// - If `ENABLE_STATIC_EXPORT_LOCALE` is true, generates paths for all available locales
// - Otherwise, generates paths only for the default locale
// @see https://nextjs.org/docs/app/api-reference/functions/generate-static-params
export const generateStaticParams = async () => {
export const generateStaticParams = () => {
// Return an empty array if static export is disabled
if (!ENABLE_STATIC_EXPORT) {
return [];
}

const versions = await provideReleaseVersions();
const versions = provideReleaseVersions();

return versions.map(version => ({
locale: defaultLocale.code,
Expand All @@ -49,14 +49,14 @@ const getPage: FC<PageParams> = async props => {
const [locale, pathname] = basePage.getLocaleAndPath(version, routeLocale);

if (version === 'current') {
const releaseData = await provideReleaseData();
const releaseData = provideReleaseData();

const release = releaseData.find(release => release.status === 'Current');

redirect(`/${locale}/download/archive/${release?.versionWithPrefix}`);
}

const versions = await provideReleaseVersions();
const versions = provideReleaseVersions();

// Verifies if the current route is a dynamic route
const isDynamicRoute = versions.some(r => r.includes(pathname));
Expand Down
2 changes: 0 additions & 2 deletions apps/site/app/[locale]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use server';

import { getTranslations } from 'next-intl/server';

import Button from '#site/components/Common/Button';
Expand Down
4 changes: 2 additions & 2 deletions apps/site/components/EOL/EOLReleaseTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import EOLReleaseTableBody from './TableBody';
import styles from './index.module.css';

const EOLReleaseTable: FC = async () => {
const releaseData = await provideReleaseData();
const vulnerabilities = await provideVulnerabilities();
const releaseData = provideReleaseData();
const vulnerabilities = provideVulnerabilities();

const eolReleases = releaseData.filter(
release => release.status === EOL_VERSION_IDENTIFIER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { FC } from 'react';
import PreviousReleasesTableBody from './TableBody';

const PreviousReleasesTable: FC = async () => {
const releaseData = await provideReleaseData();
const releaseData = provideReleaseData();

const t = await getTranslations();

Expand Down
4 changes: 2 additions & 2 deletions apps/site/components/withDownloadArchive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type WithDownloadArchiveProps = {
* Higher-order component that extracts version from pathname,
* fetches release data, and provides download artifacts to child component
*/
const WithDownloadArchive: FC<WithDownloadArchiveProps> = async ({
const WithDownloadArchive: FC<WithDownloadArchiveProps> = ({
children: Component,
}) => {
const { pathname } = getClientContext();
Expand All @@ -28,7 +28,7 @@ const WithDownloadArchive: FC<WithDownloadArchiveProps> = async ({
const version = extractVersionFromPath(pathname);

// Find the release data for the given version
const releaseData = await provideReleaseData();
const releaseData = provideReleaseData();
const release = releaseData.find(release =>
// Match major version only (e.g., v22.x.x for release.major v22)
version.startsWith(`v${release.major}`)
Expand Down
4 changes: 2 additions & 2 deletions apps/site/components/withDownloadSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const WithDownloadSection: FC<WithDownloadSectionProps> = async ({
}) => {
const locale = await getLocale();

const snippets = await provideDownloadSnippets(locale);
const snippets = provideDownloadSnippets(locale);

// By default the translated languages do not contain all the download snippets
// Hence we always merge any translated snippet with the fallbacks for missing snippets
const fallbackSnippets = await provideDownloadSnippets(defaultLocale.code);
const fallbackSnippets = provideDownloadSnippets(defaultLocale.code);

const { pathname } = getClientContext();

Expand Down
11 changes: 4 additions & 7 deletions apps/site/components/withNodeRelease.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use server';

import provideReleaseData from '#site/next-data/providers/releaseData';

import type { NodeRelease, NodeReleaseStatus } from '#site/types';
Expand All @@ -10,14 +8,13 @@ type WithNodeReleaseProps = {
children: FC<{ release: NodeRelease }>;
};

// This is a React Async Server Component
// Note that Hooks cannot be used in a RSC async component
// Async Components do not get re-rendered at all.
const WithNodeRelease: FC<WithNodeReleaseProps> = async ({
// This is a React Server Component
// Note that Hooks cannot be used in a React Server Component
const WithNodeRelease: FC<WithNodeReleaseProps> = ({
status: statuses,
children: Component,
}) => {
const releases = await provideReleaseData();
const releases = provideReleaseData();

const matchingRelease = [statuses]
.flat()
Expand Down
6 changes: 2 additions & 4 deletions apps/site/components/withReleaseSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use server';

import StatelessSelect from '@node-core/ui-components/Common/Select/StatelessSelect';

import Link from '#site/components/Link';
Expand Down Expand Up @@ -43,8 +41,8 @@ type WithReleaseSelectProps = Omit<
'values' | 'as'
>;

const WithReleaseSelect: FC<WithReleaseSelectProps> = async ({ ...props }) => {
const releaseData = await provideReleaseData();
const WithReleaseSelect: FC<WithReleaseSelectProps> = ({ ...props }) => {
const releaseData = provideReleaseData();
const navigation = groupReleasesByStatus(releaseData);

return (
Expand Down
6 changes: 2 additions & 4 deletions apps/site/components/withSupporters.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
'use server';

import provideSupporters from '#site/next-data/providers/supportersData';

import type { FC, PropsWithChildren } from 'react';

import SupportersList from './Common/Supporters';

const WithSupporters: FC<PropsWithChildren> = async () => {
const supporters = await provideSupporters();
const WithSupporters: FC<PropsWithChildren> = () => {
const supporters = provideSupporters();

return (
<div className="flex max-w-full flex-wrap items-center gap-1">
Expand Down
4 changes: 2 additions & 2 deletions apps/site/layouts/Download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import type { FC, PropsWithChildren } from 'react';

import styles from './layouts.module.css';

const DownloadLayout: FC<PropsWithChildren> = async ({ children }) => {
const DownloadLayout: FC<PropsWithChildren> = ({ children }) => {
const { frontmatter } = getClientContext();

const releases = await provideReleaseData();
const releases = provideReleaseData();

return (
<>
Expand Down
8 changes: 4 additions & 4 deletions apps/site/next-data/providers/downloadSnippets.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
'use cache';
import { cache } from 'react';

import generateDownloadSnippets from '#site/next-data/generators/downloadSnippets.mjs';

const provideDownloadSnippets = async (language: string) => {
const downloadSnippets = await generateDownloadSnippets();
const downloadSnippets = await generateDownloadSnippets();

const provideDownloadSnippets = cache((language: string) => {
if (downloadSnippets.has(language)) {
return downloadSnippets.get(language)!;
}

return [];
};
});

export default provideDownloadSnippets;
8 changes: 6 additions & 2 deletions apps/site/next-data/providers/releaseData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use cache';
import { cache } from 'react';

import provideReleaseData from '#site/next-data/generators/releaseData.mjs';
import generateReleaseData from '#site/next-data/generators/releaseData.mjs';

const releaseData = await generateReleaseData();

const provideReleaseData = cache(() => releaseData);

export default provideReleaseData;
8 changes: 6 additions & 2 deletions apps/site/next-data/providers/releaseVersions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use cache';
import { cache } from 'react';

import provideReleaseVersions from '#site/next-data/generators/releaseVersions.mjs';
import generateReleaseVersions from '#site/next-data/generators/releaseVersions.mjs';

const releaseVersions = await generateReleaseVersions();

const provideReleaseVersions = cache(() => releaseVersions);

export default provideReleaseVersions;
8 changes: 6 additions & 2 deletions apps/site/next-data/providers/supportersData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use cache';
import { cache } from 'react';

import provideSupporters from '#site/next-data/generators/supportersData.mjs';
import generateSupporters from '#site/next-data/generators/supportersData.mjs';

const supportersData = await generateSupporters();

const provideSupporters = cache(() => supportersData);

export default provideSupporters;
8 changes: 6 additions & 2 deletions apps/site/next-data/providers/vulnerabilities.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use cache';
import { cache } from 'react';

import provideVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs';
import generateVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs';

const vulnerabilities = await generateVulnerabilities();

const provideVulnerabilities = cache(() => vulnerabilities);

export default provideVulnerabilities;
2 changes: 1 addition & 1 deletion apps/site/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
import "./.next/types/routes.d.ts";
import './.next/dev/types/routes.d.ts';

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
1 change: 0 additions & 1 deletion apps/site/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const nextConfig = {
typedRoutes: true,
// Experimental Flags
experimental: {
useCache: true,
// Ensure that server-side code is also minified
serverMinification: true,
// Use Workers and Threads for webpack compilation
Expand Down
Loading