Skip to content

Commit b72f5ba

Browse files
Migrated website to nextjs (#9096)
Co-authored-by: tobias-tengler <45513122+tobias-tengler@users.noreply.github.com>
1 parent 0378a17 commit b72f5ba

File tree

530 files changed

+52019
-18848
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

530 files changed

+52019
-18848
lines changed

.devcontainer/frontend/devcontainer.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
"esbenp.prettier-vscode",
1212
"bradlc.vscode-tailwindcss",
1313
"dsznajder.es7-react-js-snippets",
14-
"csstools.postcss"
14+
"csstools.postcss",
15+
"graphql.vscode-graphql",
16+
"esbenp.prettier-vscode",
17+
"anthropic.claude-code",
18+
"openai.chatgpt"
1519
]
1620
}
1721
},
1822
"forwardPorts": [3000],
19-
"postCreateCommand": "node --version && npm --version"
23+
"postCreateCommand": "node --version && npm --version && npm i -g @anthropic-ai/claude-code"
2024
}

.docker/website/dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ RUN rm /etc/nginx/conf.d/default.conf
55

66
COPY ./website/config/conf.d /etc/nginx/conf.d
77

8-
COPY ./website/public /usr/share/nginx/html
8+
COPY ./website/out /usr/share/nginx/html

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
with:
120120
path: |
121121
website/.yarn/cache
122-
website/.cache/yarn
122+
website/.next/cache
123123
key: ${{ runner.os }}-yarn-${{ hashFiles('website/yarn.lock') }}
124124
restore-keys: |
125125
${{ runner.os }}-yarn-
@@ -129,7 +129,7 @@ jobs:
129129
working-directory: website
130130

131131
- name: Build Website
132-
run: yarn build --prefix-paths
132+
run: yarn build
133133
working-directory: website
134134

135135
configure:

.github/workflows/publish-website.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
with:
4242
path: |
4343
website/.yarn/cache
44-
website/.cache/yarn
44+
website/.next/cache
4545
key: ${{ runner.os }}-yarn-${{ hashFiles('website/yarn.lock') }}
4646
restore-keys: |
4747
${{ runner.os }}-yarn-
@@ -66,7 +66,7 @@ jobs:
6666
working-directory: website
6767

6868
- name: Build Website
69-
run: yarn build --prefix-paths
69+
run: yarn build
7070
working-directory: website
7171

7272
- name: Build WebSite Container
@@ -81,7 +81,7 @@ jobs:
8181
uses: azure/webapps-deploy@v3
8282
with:
8383
app-name: ccc-p-us1-website
84-
slot-name: "production"
84+
slot-name: "next"
8585
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
8686
images: ${{ secrets.CONTAINER_REG_DOMAIN }}/ccc-website-${{ github.ref_name }}:${{ github.run_id }}
8787

AGENTS.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,21 @@ src/GreenDonut/ # Data fetching primitives
7575
src/StrawberryShake/ # GraphQL client
7676
src/CookieCrumble/ # Snapshot testing
7777
78-
website/ # Documentation (Gatsby)
78+
website/ # Documentation (Next.js)
7979
templates/ # Project templates
8080
.build/ # Build scripts (Nuke)
8181
```
8282

8383
## Tech Stack
8484

85-
| Component | Technology |
86-
| --------- | -------------- |
87-
| Runtime | .NET 8/9/10 |
88-
| SDK | 10.0.102 |
89-
| Build | Nuke.Build |
90-
| Tests | xUnit |
91-
| Snapshots | CookieCrumble |
92-
| Docs | Gatsby + React |
85+
| Component | Technology |
86+
| --------- | --------------- |
87+
| Runtime | .NET 8/9/10 |
88+
| SDK | 10.0.102 |
89+
| Build | Nuke.Build |
90+
| Tests | xUnit |
91+
| Snapshots | CookieCrumble |
92+
| Docs | Next.js + React |
9393

9494
## Coding Standards
9595

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ src/
7070
├── CookieCrumble/ # Snapshot testing framework
7171
└── StrawberryShake/ # GraphQL client
7272
73-
website/ # Gatsby documentation site
73+
website/ # Next.js documentation site
7474
templates/ # Project templates
7575
.build/ # Nuke build automation
7676
```
@@ -80,7 +80,7 @@ templates/ # Project templates
8080
- **.NET**: SDK 10.0.102 (supports .NET 8, 9, 10)
8181
- **Build System**: Nuke.Build
8282
- **Testing**: xUnit with CookieCrumble for snapshots
83-
- **Documentation**: Gatsby + React + TypeScript
83+
- **Documentation**: Next.js + React + TypeScript
8484

8585
## Code Conventions
8686

@@ -121,7 +121,7 @@ dotnet test src/HotChocolate/Core/test/Types.Tests/HotChocolate.Types.Tests.cspr
121121

122122
```bash
123123
cd website
124-
yarn start # Development server
124+
yarn dev # Development server
125125
yarn build # Production build
126126
```
127127

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ After cloning the repository, run `init.sh` or `init.cmd`, which are located in
6969
Other more focused solution files exist if you want to narrow in on a particular part of the platform.
7070
The smaller solution files are great when working with VSCode.
7171

72-
The documentation is located in the `website` directory and can be started with `yarn start`.
72+
The documentation is located in the `website` directory and can be started with `yarn dev`.
7373

7474
There are other available commands too. As set up in the [.build](./.build/) directory.
7575

website/.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ typings/
5959
# dotenv environment variable files
6060
.env*
6161

62-
# gatsby files
62+
# gatsby files (legacy)
6363
.cache/
64-
public
6564
/graphql-types.ts
6665

66+
# next.js
67+
.next/
68+
out/
69+
next-env.d.ts
70+
6771
# Mac files
6872
.DS_Store

website/.yarnrc.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,15 @@ enableGlobalCache: false
44

55
nodeLinker: node-modules
66

7+
supportedArchitectures:
8+
os:
9+
- current
10+
- linux
11+
- darwin
12+
- win32
13+
cpu:
14+
- current
15+
- arm64
16+
- x64
17+
718
yarnPath: .yarn/releases/yarn-4.8.1.cjs
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import React from "react";
2+
3+
import {
4+
getAllBlogPosts,
5+
getBlogPostBySlug,
6+
getLatestPostsForNav,
7+
getPaginatedPosts,
8+
getPostsPerPage,
9+
} from "@/lib/blog";
10+
import { compileMdxContent, extractHeadings } from "@/lib/mdx";
11+
import { createMetadata } from "@/lib/metadata";
12+
import { BlogPostPage } from "@/lib/blog-post-page";
13+
import { BlogListPage } from "@/lib/blog-list-page";
14+
import { notFound } from "next/navigation";
15+
16+
interface PageProps {
17+
params: Promise<{ slug: string[] }>;
18+
}
19+
20+
export async function generateStaticParams() {
21+
const posts = getAllBlogPosts();
22+
const postsPerPage = getPostsPerPage();
23+
const totalPages = Math.ceil(posts.length / postsPerPage);
24+
25+
const params: { slug: string[] }[] = [];
26+
27+
// Pagination pages (page 2+)
28+
for (let i = 2; i <= totalPages; i++) {
29+
params.push({ slug: [String(i)] });
30+
}
31+
32+
// Blog post pages (year/month/day/slug)
33+
for (const post of posts) {
34+
const parts = post.slug.replace(/^\/blog\//, "").split("/");
35+
params.push({ slug: parts });
36+
}
37+
38+
return params;
39+
}
40+
41+
export async function generateMetadata({ params }: PageProps) {
42+
const { slug } = await params;
43+
44+
// Pagination page
45+
if (slug.length === 1 && /^\d+$/.test(slug[0])) {
46+
return createMetadata({ title: `Blog - Page ${slug[0]}` });
47+
}
48+
49+
// Blog post (year/month/day/slug)
50+
if (slug.length === 4) {
51+
const postSlug = `/blog/${slug.join("/")}`;
52+
const post = getBlogPostBySlug(postSlug);
53+
54+
return createMetadata({
55+
title: post?.title || "Blog Post",
56+
description: post?.description,
57+
isArticle: true,
58+
imageUrl: post?.featuredImage,
59+
});
60+
}
61+
62+
return createMetadata({ title: "Blog" });
63+
}
64+
65+
export default async function BlogCatchAllPage({ params }: PageProps) {
66+
const { slug } = await params;
67+
68+
// Pagination page (e.g., /blog/2, /blog/3)
69+
if (slug.length === 1 && /^\d+$/.test(slug[0])) {
70+
const pageNum = parseInt(slug[0], 10);
71+
const { posts, totalPages } = getPaginatedPosts(pageNum);
72+
73+
return (
74+
<BlogListPage
75+
posts={posts}
76+
currentPage={pageNum}
77+
totalPages={totalPages}
78+
linkPrefix="/blog"
79+
/>
80+
);
81+
}
82+
83+
// Blog post page (e.g., /blog/2024/01/15/my-post)
84+
if (slug.length === 4) {
85+
const postSlug = `/blog/${slug.join("/")}`;
86+
const post = getBlogPostBySlug(postSlug);
87+
88+
if (!post) {
89+
return notFound();
90+
}
91+
92+
const { mdxSource } = await compileMdxContent(post.content);
93+
const headings = extractHeadings(post.content);
94+
const latestPosts = getLatestPostsForNav();
95+
96+
return (
97+
<BlogPostPage
98+
post={post}
99+
mdxSource={mdxSource}
100+
headings={headings}
101+
latestPosts={latestPosts}
102+
/>
103+
);
104+
}
105+
106+
return notFound();
107+
}

0 commit comments

Comments
 (0)