Skip to content

Commit f242827

Browse files
authored
feat: migrate to fumadocs
2 parents 9db50ec + 342b1ac commit f242827

File tree

154 files changed

+18049
-6673
lines changed

Some content is hidden

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

154 files changed

+18049
-6673
lines changed

.eslintrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
1-
name: GitHub Actions Vercel Production Deployment
2-
env:
3-
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4-
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
1+
name: Deploy to Cloudflare Workers
2+
53
on:
64
push:
75
branches:
86
- main
97
workflow_dispatch:
10-
8+
119
jobs:
12-
CI:
10+
deploy:
1311
runs-on: ubuntu-latest
1412
steps:
1513
- uses: actions/checkout@v4
14+
1615
- uses: pnpm/action-setup@v3
1716
with:
1817
version: 9
19-
- name: Install Vercel CLI
20-
run: pnpm install --global vercel@canary
21-
- name: Pull Vercel Environment Information
22-
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
23-
- name: Build Project Artifacts
24-
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
25-
- name: Deploy Project Artifacts to Vercel
26-
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: pnpm
23+
24+
- name: Install dependencies
25+
run: pnpm install --frozen-lockfile
26+
27+
- name: Build (Next.js + opennext)
28+
run: pnpm build:worker
29+
30+
- name: Deploy to Cloudflare Workers
31+
run: pnpm cf:deploy
32+
env:
33+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Sync Extensions
2+
3+
on:
4+
schedule:
5+
- cron: "0 * * * *" # every hour
6+
workflow_dispatch:
7+
8+
jobs:
9+
sync:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: pnpm/action-setup@v3
15+
with:
16+
version: 9
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
cache: pnpm
22+
23+
- name: Install dependencies
24+
run: pnpm install --frozen-lockfile
25+
26+
- name: Sync extensions
27+
env:
28+
WORKER_URL: https://gopeed.com
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
run: pnpm sync:extensions

.gitignore

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,29 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
1+
# deps
42
/node_modules
5-
/.pnp
6-
.pnp.js
73

8-
# testing
9-
/coverage
4+
# generated content
5+
.source
6+
/lib/openapi/swagger.json
107

11-
# next.js
8+
# test & build
9+
/coverage
1210
/.next/
11+
/.open-next/
12+
/.wrangler/
1313
/out/
14-
15-
# production
1614
/build
15+
*.tsbuildinfo
1716

1817
# misc
1918
.DS_Store
2019
*.pem
21-
22-
# debug
20+
/.pnp
21+
.pnp.js
2322
npm-debug.log*
2423
yarn-debug.log*
2524
yarn-error.log*
26-
.pnpm-debug.log*
2725

28-
# local env files
26+
# others
2927
.env*.local
30-
31-
# vercel
3228
.vercel
33-
34-
/public/robots.txt
35-
/public/sitemap*.xml
29+
next-env.d.ts

.prettierrc.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
1-
## Access
1+
# gopeed-website-fuma
22

3-
[https://gopeed.com](https://gopeed.com)
3+
This is a Next.js application generated with
4+
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
45

5-
## Getting Started
6-
7-
First, run the development server:
6+
Run development server:
87

98
```bash
109
npm run dev
1110
# or
12-
yarn dev
13-
# or
1411
pnpm dev
12+
# or
13+
yarn dev
1514
```
1615

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
16+
Open http://localhost:3000 with your browser to see the result.
1817

19-
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
18+
## Explore
2019

21-
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
20+
In the project, you can see:
2221

23-
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
22+
- `lib/source.ts`: Code for content source adapter, [`loader()`](https://fumadocs.dev/docs/headless/source-api) provides the interface to access your content.
23+
- `lib/layout.shared.tsx`: Shared options for layouts, optional but preferred to keep.
2424

25-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
25+
| Route | Description |
26+
| ------------------------- | ------------------------------------------------------ |
27+
| `app/(home)` | The route group for your landing page and other pages. |
28+
| `app/docs` | The documentation layout and pages. |
29+
| `app/api/search/route.ts` | The Route Handler for search. |
2630

27-
## Learn More
28-
29-
To learn more about Next.js, take a look at the following resources:
31+
### Fumadocs MDX
3032

31-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
32-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
33+
A `source.config.ts` config file has been included, you can customise different options like frontmatter schema.
3334

34-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
35+
Read the [Introduction](https://fumadocs.dev/docs/mdx) for further details.
3536

36-
## Deploy on Vercel
37+
## Learn More
3738

38-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
39+
To learn more about Next.js and Fumadocs, take a look at the following
40+
resources:
3941

40-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
42+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
43+
features and API.
44+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
45+
- [Fumadocs](https://fumadocs.dev) - learn about Fumadocs

app/[lang]/(home)/layout.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { ReactNode } from "react";
2+
3+
interface LayoutProps {
4+
children: ReactNode;
5+
}
6+
7+
export default function HomeLayout({ children }: LayoutProps) {
8+
return <>{children}</>;
9+
}

app/[lang]/(home)/page.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import type { Metadata } from "next";
2+
import {
3+
Downloads,
4+
Extensions,
5+
Features,
6+
Footer,
7+
Hero,
8+
Navbar,
9+
} from "@/components/home";
10+
import { getAppData } from "@/lib/data";
11+
import { i18n, type Locale, locales } from "@/lib/i18n";
12+
import { pageAlternates } from "@/lib/seo";
13+
14+
export async function generateMetadata({
15+
params,
16+
}: {
17+
params: Promise<{ lang: string }>;
18+
}): Promise<Metadata> {
19+
const { lang } = await params;
20+
const locale = (
21+
locales.includes(lang as Locale) ? lang : i18n.defaultLanguage
22+
) as Locale;
23+
return {
24+
alternates: pageAlternates(locale, "/"),
25+
};
26+
}
27+
28+
export default async function HomePage() {
29+
// Fetch data during SSR
30+
const appData = await getAppData();
31+
32+
return (
33+
<main className="min-h-screen stable-vh overflow-x-clip bg-white dark:bg-gray-950 text-gray-900 dark:text-gray-100 relative">
34+
{/* Global background effects - only visible in dark mode */}
35+
<div className="fixed inset-0 -z-10 dark:block hidden">
36+
{/* Main background gradient */}
37+
<div className="absolute inset-0 bg-gradient-to-b from-gray-950 via-gray-900 to-gray-950" />
38+
39+
{/* Dynamic light effect */}
40+
<div className="absolute inset-0 bg-gradient-radial from-primary-900/20 via-transparent to-transparent opacity-50" />
41+
42+
{/* Decorative gradients */}
43+
<div className="absolute top-0 right-0 w-[800px] h-[600px] bg-primary-900/20 rounded-full blur-3xl opacity-20 animate-pulse-slow" />
44+
<div className="absolute bottom-0 left-0 w-[600px] h-[400px] bg-primary-900/20 rounded-full blur-3xl opacity-20 animate-pulse-slow" />
45+
</div>
46+
47+
<Navbar version={appData.version} stars={appData.stars} />
48+
<Hero version={appData.version} releaseAssets={appData.releaseAssets} />
49+
<Features />
50+
<Extensions />
51+
<Downloads
52+
version={appData.version}
53+
releaseAssets={appData.releaseAssets}
54+
/>
55+
<Footer />
56+
</main>
57+
);
58+
}

app/[lang]/(home)/store/page.tsx

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { getCloudflareContext } from "@opennextjs/cloudflare";
2+
import { desc } from "drizzle-orm";
3+
import type { Metadata } from "next";
4+
import { Footer } from "@/components/home/Footer";
5+
import { Navbar } from "@/components/home/Navbar";
6+
import { StoreGrid } from "@/components/store/StoreGrid";
7+
import { getDb } from "@/db/client";
8+
import { type Extension, extensions } from "@/db/schema";
9+
import { getAppData } from "@/lib/data";
10+
import { i18n, type Locale, locales } from "@/lib/i18n";
11+
import { getTranslation } from "@/lib/i18n/translations";
12+
import { pageAlternates } from "@/lib/seo";
13+
14+
export async function generateMetadata({
15+
params,
16+
}: {
17+
params: Promise<{ lang: string }>;
18+
}): Promise<Metadata> {
19+
const { lang } = await params;
20+
const locale = (
21+
locales.includes(lang as Locale) ? lang : i18n.defaultLanguage
22+
) as Locale;
23+
const t = (key: string) => getTranslation(locale, key);
24+
25+
return {
26+
title: t("store.title"),
27+
description: t("store.subtitle"),
28+
alternates: pageAlternates(locale, "/store"),
29+
};
30+
}
31+
32+
export default async function StorePage({
33+
params,
34+
}: {
35+
params: Promise<{ lang: string }>;
36+
}) {
37+
const { lang } = await params;
38+
const locale = (
39+
locales.includes(lang as Locale) ? lang : i18n.defaultLanguage
40+
) as Locale;
41+
42+
const appData = await getAppData();
43+
44+
let extensionList: Extension[] = [];
45+
46+
try {
47+
const ctx = await getCloudflareContext({ async: true });
48+
// @ts-expect-error - CF env type
49+
const d1 = ctx.env.DB as D1Database | undefined;
50+
51+
if (d1) {
52+
const db = getDb(d1);
53+
extensionList = await db
54+
.select()
55+
.from(extensions)
56+
.orderBy(desc(extensions.installCount), desc(extensions.stars))
57+
.all();
58+
}
59+
} catch (err) {
60+
console.error("Failed to connect to D1:", err);
61+
}
62+
63+
const t = (key: string) => getTranslation(locale, key);
64+
65+
return (
66+
<main className="min-h-screen stable-vh overflow-x-clip bg-white dark:bg-[#0A0A0A] text-gray-900 dark:text-gray-100 relative">
67+
<Navbar version={appData.version} stars={appData.stars} />
68+
69+
{/* ── Minimalist Hero Header ── */}
70+
<section className="relative pt-32 pb-12 lg:pt-40 lg:pb-16 overflow-hidden">
71+
<div className="max-w-7xl mx-auto px-6 sm:px-8 lg:px-16 relative">
72+
<div className="max-w-3xl mx-auto text-center">
73+
<h1 className="text-4xl sm:text-5xl lg:text-6xl font-semibold tracking-tight text-gray-950 dark:text-white mb-5">
74+
{t("store.title")}
75+
</h1>
76+
<p className="text-lg sm:text-xl text-gray-500 dark:text-gray-400 font-medium tracking-wide">
77+
{t("store.subtitle")}
78+
</p>
79+
</div>
80+
</div>
81+
</section>
82+
83+
{/* ── Extension grid ── */}
84+
<div className="max-w-7xl mx-auto px-6 sm:px-8 lg:px-16 pb-24 relative">
85+
<div className="max-w-6xl mx-auto">
86+
<StoreGrid extensions={extensionList} />
87+
</div>
88+
</div>
89+
90+
<Footer />
91+
</main>
92+
);
93+
}

0 commit comments

Comments
 (0)