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
4 changes: 2 additions & 2 deletions apps/site/app/[locale]/feed/[feed]/route.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NextResponse } from 'next/server';

import provideWebsiteFeeds from '#site/next-data/providers/websiteFeeds';
import { siteConfig } from '#site/next.json.mjs';
import { defaultLocale } from '#site/next.locales.mjs';
import { getFeeds } from '#site/util/feeds';

type DynamicStaticPaths = { locale: string; feed: string };
type StaticParams = { params: Promise<DynamicStaticPaths> };
Expand All @@ -14,7 +14,7 @@ export const GET = async (_: Request, props: StaticParams) => {
const params = await props.params;

// Generate the Feed for the given feed type (blog, releases, etc)
const websiteFeed = provideWebsiteFeeds(params.feed);
const websiteFeed = getFeeds(params.feed);

return new NextResponse(websiteFeed, {
headers: { 'Content-Type': 'application/xml' },
Expand Down
2 changes: 1 addition & 1 deletion apps/site/components/Blog/BlogPostCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type BlogPostCardProps = {
category: BlogCategory;
description?: string;
authors?: Array<string>;
date?: Date;
date?: string | Date;
slug?: string;
};

Expand Down
2 changes: 1 addition & 1 deletion apps/site/components/withBlogCrossLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { FC } from 'react';

import { getClientContext } from '#site/client-context';
import CrossLink from '#site/components/Common/CrossLink';
import getBlogData from '#site/next-data/blogData';
import type { BlogCategory } from '#site/types';
import { getBlogData } from '#site/util/blog';

const WithBlogCrossLinks: FC = () => {
const { pathname } = getClientContext();
Expand Down
17 changes: 9 additions & 8 deletions apps/site/components/withDownloadSection.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLocale } from 'next-intl';
import { getLocale } from 'next-intl/server';
import type { FC, PropsWithChildren } from 'react';

import { getClientContext } from '#site/client-context';
Expand All @@ -12,21 +12,22 @@ import {

import type { NodeRelease } from '../types';

// 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 = provideDownloadSnippets(defaultLocale.code);

type WithDownloadSectionProps = PropsWithChildren<{
releases: Array<NodeRelease>;
}>;

const WithDownloadSection: FC<WithDownloadSectionProps> = ({
const WithDownloadSection: FC<WithDownloadSectionProps> = async ({
releases,
children,
}) => {
const locale = useLocale();
const locale = await getLocale();

const snippets = await 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 snippets = provideDownloadSnippets(locale);
const { pathname } = getClientContext();

// Some available translations do not have download snippets translated or have them partially translated
Expand Down
2 changes: 1 addition & 1 deletion apps/site/layouts/Blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import BlogHeader from '#site/components/Blog/BlogHeader';
import WithBlogCategories from '#site/components/withBlogCategories';
import WithFooter from '#site/components/withFooter';
import WithNavBar from '#site/components/withNavBar';
import getBlogData from '#site/next-data/blogData';
import type { BlogCategory } from '#site/types';
import { getBlogData } from '#site/util/blog';

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

Expand Down
16 changes: 0 additions & 16 deletions apps/site/next-data/blogData.ts

This file was deleted.

116 changes: 0 additions & 116 deletions apps/site/next-data/generators/blogData.mjs

This file was deleted.

69 changes: 0 additions & 69 deletions apps/site/next-data/providers/blogData.ts

This file was deleted.

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 @@
import { cache } from 'react';
'use cache';

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

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

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

return [];
});
};

export default provideDownloadSnippets;
16 changes: 0 additions & 16 deletions apps/site/next-data/providers/websiteFeeds.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/site/next.dynamic.constants.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

import { provideBlogPosts } from '#site/next-data/providers/blogData';
import { blogData } from '#site/next.json.mjs';

import { BASE_PATH, BASE_URL } from './next.constants.mjs';
import { siteConfig } from './next.json.mjs';
import { getBlogPosts } from './util/blog';

/**
* This constant is used to create static routes on-the-fly that do not have a file-system
Expand All @@ -19,7 +19,7 @@ export const BLOG_DYNAMIC_ROUTES = [
// Provides Routes for all Blog Categories w/ Pagination
...blogData.categories
// retrieves the amount of pages for each blog category
.map(c => [c, provideBlogPosts(c).pagination.pages])
.map(c => [c, getBlogPosts(c).pagination.pages])
// creates a numeric array for each page and define a pathname for
// each page for a category (i.e. blog/all/page/1)
.map(([c, t]) => [...Array(t).keys()].map(p => `${c}/page/${p + 1}`))
Expand Down
4 changes: 2 additions & 2 deletions apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"scripts": {
"prebuild": "node --run build:blog-data",
"build": "node --run build:default -- --turbo",
"build:blog-data": "cross-env NODE_NO_WARNINGS=1 node ./scripts/blog-data/generate.mjs",
"build:blog-data:watch": "node --watch --watch-path=pages/en/blog ./scripts/blog-data/generate.mjs",
"build:blog-data": "cross-env NODE_NO_WARNINGS=1 node ./scripts/blog-data/index.mjs",
"build:blog-data:watch": "node --watch --watch-path=pages/en/blog ./scripts/blog-data/index.mjs",
"build:default": "cross-env NODE_NO_WARNINGS=1 next build",
"cloudflare:build:worker": "OPEN_NEXT_CLOUDFLARE=true opennextjs-cloudflare build",
"cloudflare:deploy": "opennextjs-cloudflare deploy",
Expand Down
Loading
Loading