mirror of
https://github.com/LiuYuYang01/ThriveX-Blog.git
synced 2026-06-01 02:09:34 +08:00
升级Nextjs15
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
# 使用官方的Node.js镜像作为基础镜像
|
||||
FROM node:20-alpine
|
||||
|
||||
# # 设置工作目录
|
||||
WORKDIR /thrive
|
||||
|
||||
# 配置 npm 镜像源
|
||||
RUN npm config set registry https://registry.npmmirror.com
|
||||
|
||||
# 安装依赖
|
||||
RUN npm install
|
||||
|
||||
# 复制所有文件到工作目录
|
||||
COPY . .
|
||||
|
||||
# 构建Next.js应用
|
||||
RUN npm run build
|
||||
|
||||
# 第二阶段:部署 Node.js 应用并集成 Nginx
|
||||
FROM nginx:alpine
|
||||
|
||||
COPY --from=builder /thrive/build /usr/share/nginx/html
|
||||
|
||||
|
||||
# 暴露应用运行的端口
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
9812
package-lock.json
generated
9812
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@@ -3,7 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start -p 9001",
|
||||
"lint": "next lint"
|
||||
@@ -22,11 +22,11 @@
|
||||
"feed": "^4.2.2",
|
||||
"github-markdown-css": "^5.6.1",
|
||||
"mdast-util-gfm-autolink-literal": "^2.0.0",
|
||||
"next": "^14.2.22",
|
||||
"next": "15.1.7",
|
||||
"next-nprogress-bar": "^2.3.13",
|
||||
"react": "^18",
|
||||
"react": "19.0.0",
|
||||
"react-copy-to-clipboard": "^5.1.0",
|
||||
"react-dom": "^18",
|
||||
"react-dom": "19.0.0",
|
||||
"react-github-calendar": "^4.5.5",
|
||||
"react-hook-form": "^7.53.0",
|
||||
"react-icons": "^5.3.0",
|
||||
@@ -52,10 +52,14 @@
|
||||
"@types/canvas-confetti": "^1.6.4",
|
||||
"@types/markdown-navbar": "^1.4.4",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"@types/react": "19.0.10",
|
||||
"@types/react-dom": "19.0.4",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5"
|
||||
},
|
||||
"overrides": {
|
||||
"@types/react": "19.0.10",
|
||||
"@types/react-dom": "19.0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,17 @@ import Encrypt from '@/components/Encrypt';
|
||||
import NotFound from '@/app/not-found';
|
||||
|
||||
interface Props {
|
||||
params: { id: number };
|
||||
searchParams: { password: string }
|
||||
params: Promise<{ id: number }>;
|
||||
searchParams: Promise<{ password: string }>
|
||||
};
|
||||
|
||||
export default async ({ params, searchParams }: Props) => {
|
||||
export default async (props: Props) => {
|
||||
const searchParams = await props.searchParams;
|
||||
const params = await props.params;
|
||||
const id = params.id
|
||||
const password = searchParams.password
|
||||
|
||||
const { code, data } = password ? await getArticleDataAPI(id, password) || { data: {} as Article } : await getArticleDataAPI(id) || { data: {} as Article }
|
||||
const { code, data } = password ? (await getArticleDataAPI(id, password)) || { data: {} as Article } : (await getArticleDataAPI(id)) || { data: {} as Article }
|
||||
|
||||
const errorCodes = [400, 404, 611]
|
||||
|
||||
@@ -100,4 +102,4 @@ export default async ({ params, searchParams }: Props) => {
|
||||
} else {
|
||||
return !password && <Encrypt id={id} />
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -6,16 +6,18 @@ import Pagination from "@/components/Pagination";
|
||||
import { Article } from "@/types/app/article";
|
||||
|
||||
interface Props {
|
||||
params: { id: number };
|
||||
searchParams: { page: number; name: string };
|
||||
params: Promise<{ id: number }>;
|
||||
searchParams: Promise<{ page: number; name: string }>;
|
||||
};
|
||||
|
||||
export default async ({ params, searchParams }: Props) => {
|
||||
export default async (props: Props) => {
|
||||
const searchParams = await props.searchParams;
|
||||
const params = await props.params;
|
||||
const id = params.id;
|
||||
const page = searchParams.page || 1;
|
||||
const name = searchParams.name;
|
||||
|
||||
const { data } = await getCateArticleListAPI(id, page) || { data: {} as Paginate<Article[]> }
|
||||
const { data } = (await getCateArticleListAPI(id, page)) || { data: {} as Paginate<Article[]> }
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -41,4 +43,4 @@ export default async ({ params, searchParams }: Props) => {
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
};
|
||||
@@ -10,16 +10,17 @@ import { Theme } from "@/types/app/project";
|
||||
import Lantern from "@/components/Lantern";
|
||||
|
||||
interface Props {
|
||||
searchParams: { page: number };
|
||||
searchParams: Promise<{ page: number }>;
|
||||
};
|
||||
|
||||
export default async ({ searchParams }: Props) => {
|
||||
export default async (props: Props) => {
|
||||
const searchParams = await props.searchParams;
|
||||
const page = searchParams.page || 1;
|
||||
const { data } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
|
||||
const { data } = (await getConfigDataAPI<Theme>("layout")) || { data: {} as Theme }
|
||||
|
||||
return (
|
||||
<>
|
||||
<Lantern data={['新', '春', '快', '乐']} />
|
||||
{/* <Lantern data={['新', '春', '快', '乐']} /> */}
|
||||
|
||||
<Swiper src={data?.swiper_image}>
|
||||
{/* 星空背景组件 */}
|
||||
@@ -36,4 +37,4 @@ export default async ({ searchParams }: Props) => {
|
||||
</Container>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -12,15 +12,16 @@ import { getConfigDataAPI } from "@/api/project";
|
||||
import { Theme } from "@/types/app/project";
|
||||
|
||||
interface Props {
|
||||
searchParams: { page: number };
|
||||
searchParams: Promise<{ page: number }>;
|
||||
};
|
||||
|
||||
export default async ({ searchParams }: Props) => {
|
||||
export default async (props: Props) => {
|
||||
const searchParams = await props.searchParams;
|
||||
const page = searchParams.page || 1;
|
||||
|
||||
const { data: user } = await getUserDataAPI() || { data: {} as User }
|
||||
const { data: record } = await getRecordPagingAPI({ pagination: { page, size: 8 } }) || { data: {} as Paginate<Record[]> }
|
||||
const { data: theme } = await getConfigDataAPI<Theme>("layout") || { data: {} as Theme }
|
||||
const { data: user } = (await getUserDataAPI()) || { data: {} as User }
|
||||
const { data: record } = (await getRecordPagingAPI({ pagination: { page, size: 8 } })) || { data: {} as Paginate<Record[]> }
|
||||
const { data: theme } = (await getConfigDataAPI<Theme>("layout")) || { data: {} as Theme }
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -72,4 +73,4 @@ export default async ({ searchParams }: Props) => {
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
};
|
||||
@@ -7,11 +7,13 @@ import { Cate } from '@/types/app/cate';
|
||||
import { Wall } from '@/types/app/wall';
|
||||
|
||||
interface Props {
|
||||
params: { cate: string };
|
||||
searchParams: { page: number }
|
||||
params: Promise<{ cate: string }>;
|
||||
searchParams: Promise<{ page: number }>
|
||||
}
|
||||
|
||||
export default async ({ params, searchParams }: Props) => {
|
||||
export default async (props: Props) => {
|
||||
const searchParams = await props.searchParams;
|
||||
const params = await props.params;
|
||||
const cate = params.cate
|
||||
const page = searchParams.page || 1;
|
||||
|
||||
@@ -20,10 +22,10 @@ export default async ({ params, searchParams }: Props) => {
|
||||
// 提前把颜色写好,否则会导致样式丢失
|
||||
const colors = ["bg-[#fcafa24d]", "bg-[#a8ed8a4d]", "bg-[#caa7f74d]", "bg-[#ffe3944d]", "bg-[#92e6f54d]"]
|
||||
|
||||
const { data: cateList } = await getCateListAPI() || { data: [] as Cate[] }
|
||||
const { data: cateList } = (await getCateListAPI()) || { data: [] as Cate[] }
|
||||
|
||||
const id = cateList.find(item => item.mark === cate)?.id!
|
||||
const { data: tallList } = await getCateWallListAPI(id, page) || { data: {} as Paginate<Wall[]> }
|
||||
const { data: tallList } = (await getCateWallListAPI(id, page)) || { data: {} as Paginate<Wall[]> }
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -69,4 +71,4 @@ export default async ({ params, searchParams }: Props) => {
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
};
|
||||
@@ -1,3 +1,5 @@
|
||||
"use client"
|
||||
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import { Tooltip } from "@heroui/react";
|
||||
|
||||
Reference in New Issue
Block a user