diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0856da7579ba..af838056c57e3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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' }} @@ -77,3 +75,14 @@ jobs: with: name: webpack-stats path: apps/site/.next/server/webpack-stats.json + + - name: Build Next.js (Static Export) + # 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' }} diff --git a/apps/site/app/[locale]/not-found.tsx b/apps/site/app/[locale]/not-found.tsx index c6dc76a682af8..4dbfb3f5202df 100644 --- a/apps/site/app/[locale]/not-found.tsx +++ b/apps/site/app/[locale]/not-found.tsx @@ -1,5 +1,3 @@ -'use server'; - import { getTranslations } from 'next-intl/server'; import Button from '#site/components/Common/Button'; diff --git a/apps/site/components/withDownloadSection.tsx b/apps/site/components/withDownloadSection.tsx index 3dcb3a1f5cc19..61895f345f6bf 100644 --- a/apps/site/components/withDownloadSection.tsx +++ b/apps/site/components/withDownloadSection.tsx @@ -22,19 +22,21 @@ const WithDownloadSection: FC = async ({ }) => { const locale = await getLocale(); - const snippets = await provideDownloadSnippets(locale); + const snippets = await provideDownloadSnippets(); + + const localeSnippets = snippets.get(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 = snippets.get(defaultLocale.code) ?? []; const { pathname } = getClientContext(); // Some available translations do not have download snippets translated or have them partially translated // This aims to merge the available translated snippets with the fallback snippets const memoizedSnippets = fallbackSnippets - .filter(snippet => !snippets.some(s => s.name === snippet.name)) - .concat(snippets); + .filter(snippet => !localeSnippets.some(s => s.name === snippet.name)) + .concat(localeSnippets); // Decides which initial release to use based on the current pathname const initialRelease = pathname.endsWith('/current') diff --git a/apps/site/components/withNodeRelease.tsx b/apps/site/components/withNodeRelease.tsx index f161c8939caf0..bdacc99f8e121 100644 --- a/apps/site/components/withNodeRelease.tsx +++ b/apps/site/components/withNodeRelease.tsx @@ -1,5 +1,3 @@ -'use server'; - import provideReleaseData from '#site/next-data/providers/releaseData'; import type { NodeRelease, NodeReleaseStatus } from '#site/types'; diff --git a/apps/site/components/withReleaseSelect.tsx b/apps/site/components/withReleaseSelect.tsx index 64df156d05d88..53a7469212988 100644 --- a/apps/site/components/withReleaseSelect.tsx +++ b/apps/site/components/withReleaseSelect.tsx @@ -1,5 +1,3 @@ -'use server'; - import StatelessSelect from '@node-core/ui-components/Common/Select/StatelessSelect'; import Link from '#site/components/Link'; diff --git a/apps/site/components/withSupporters.tsx b/apps/site/components/withSupporters.tsx index a75cac8f713fb..876035b78458d 100644 --- a/apps/site/components/withSupporters.tsx +++ b/apps/site/components/withSupporters.tsx @@ -1,5 +1,3 @@ -'use server'; - import provideSupporters from '#site/next-data/providers/supportersData'; import type { FC, PropsWithChildren } from 'react'; diff --git a/apps/site/next-data/generators/majorNodeReleases.mjs b/apps/site/next-data/generators/majorNodeReleases.mjs index 7988067b63040..0a9a06e8cd5e4 100644 --- a/apps/site/next-data/generators/majorNodeReleases.mjs +++ b/apps/site/next-data/generators/majorNodeReleases.mjs @@ -2,12 +2,12 @@ import nodevu from '@nodevu/core'; -const nodevuData = await nodevu({ fetch }); - /** * Filters Node.js release data to return only major releases with documented support. */ export default async function getMajorNodeReleases() { + const nodevuData = await nodevu({ fetch }); + return Object.entries(nodevuData).filter(([version, { support }]) => { // Filter out those without documented support // Basically those not in schedule.json diff --git a/apps/site/next-data/providers/downloadSnippets.ts b/apps/site/next-data/providers/downloadSnippets.ts index 2c1674ad0f9c8..5aa909bda3915 100644 --- a/apps/site/next-data/providers/downloadSnippets.ts +++ b/apps/site/next-data/providers/downloadSnippets.ts @@ -1,15 +1,5 @@ -'use cache'; +import { cache } from 'react'; import generateDownloadSnippets from '#site/next-data/generators/downloadSnippets.mjs'; -const provideDownloadSnippets = async (language: string) => { - const downloadSnippets = await generateDownloadSnippets(); - - if (downloadSnippets.has(language)) { - return downloadSnippets.get(language)!; - } - - return []; -}; - -export default provideDownloadSnippets; +export default cache(generateDownloadSnippets); diff --git a/apps/site/next-data/providers/releaseData.ts b/apps/site/next-data/providers/releaseData.ts index c063dd8fd5ea5..853cffd03d09d 100644 --- a/apps/site/next-data/providers/releaseData.ts +++ b/apps/site/next-data/providers/releaseData.ts @@ -1,5 +1,5 @@ -'use cache'; +import { cache } from 'react'; -import provideReleaseData from '#site/next-data/generators/releaseData.mjs'; +import generateReleaseData from '#site/next-data/generators/releaseData.mjs'; -export default provideReleaseData; +export default cache(generateReleaseData); diff --git a/apps/site/next-data/providers/releaseVersions.ts b/apps/site/next-data/providers/releaseVersions.ts index d9aa33346dc41..a057e76f7264c 100644 --- a/apps/site/next-data/providers/releaseVersions.ts +++ b/apps/site/next-data/providers/releaseVersions.ts @@ -1,5 +1,5 @@ -'use cache'; +import { cache } from 'react'; -import provideReleaseVersions from '#site/next-data/generators/releaseVersions.mjs'; +import generateReleaseVersions from '#site/next-data/generators/releaseVersions.mjs'; -export default provideReleaseVersions; +export default cache(generateReleaseVersions); diff --git a/apps/site/next-data/providers/supportersData.ts b/apps/site/next-data/providers/supportersData.ts index e6e34a6877590..cb5c161ba09bf 100644 --- a/apps/site/next-data/providers/supportersData.ts +++ b/apps/site/next-data/providers/supportersData.ts @@ -1,5 +1,5 @@ -'use cache'; +import { cache } from 'react'; -import provideSupporters from '#site/next-data/generators/supportersData.mjs'; +import generateSupporters from '#site/next-data/generators/supportersData.mjs'; -export default provideSupporters; +export default cache(generateSupporters); diff --git a/apps/site/next-data/providers/vulnerabilities.ts b/apps/site/next-data/providers/vulnerabilities.ts index e360781eebd10..508a1cc95efef 100644 --- a/apps/site/next-data/providers/vulnerabilities.ts +++ b/apps/site/next-data/providers/vulnerabilities.ts @@ -1,5 +1,5 @@ -'use cache'; +import { cache } from 'react'; -import provideVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs'; +import generateVulnerabilities from '#site/next-data/generators/vulnerabilities.mjs'; -export default provideVulnerabilities; +export default cache(generateVulnerabilities); diff --git a/apps/site/next-env.d.ts b/apps/site/next-env.d.ts index 2d5420ebae639..cdb6b7b848c32 100644 --- a/apps/site/next-env.d.ts +++ b/apps/site/next-env.d.ts @@ -1,7 +1,7 @@ /// /// /// -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. diff --git a/apps/site/next.config.mjs b/apps/site/next.config.mjs index c8f6bc2c4d290..fa4f0256b90c2 100644 --- a/apps/site/next.config.mjs +++ b/apps/site/next.config.mjs @@ -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