Skip to content
Merged
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
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 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' }}
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
10 changes: 6 additions & 4 deletions apps/site/components/withDownloadSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,21 @@ const WithDownloadSection: FC<WithDownloadSectionProps> = 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')
Expand Down
2 changes: 0 additions & 2 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 Down
2 changes: 0 additions & 2 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
2 changes: 0 additions & 2 deletions apps/site/components/withSupporters.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use server';

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

import type { FC, PropsWithChildren } from 'react';
Expand Down
4 changes: 2 additions & 2 deletions apps/site/next-data/generators/majorNodeReleases.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 2 additions & 12 deletions apps/site/next-data/providers/downloadSnippets.ts
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 3 additions & 3 deletions apps/site/next-data/providers/releaseData.ts
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 3 additions & 3 deletions apps/site/next-data/providers/releaseVersions.ts
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 3 additions & 3 deletions apps/site/next-data/providers/supportersData.ts
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 3 additions & 3 deletions apps/site/next-data/providers/vulnerabilities.ts
Original file line number Diff line number Diff line change
@@ -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);
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