mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-09 09:06:36 +08:00
build: 优化 Docker/Workflow 构建,使用 Next.js 环境变量注入版本和构建时间,并移除对 package.json 的硬编码替换
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import {Info, Server} from "lucide-react"
|
||||
import packageJson from "../../../package.json"
|
||||
import {APP_VERSION, APP_BUILD_DATE} from "@/lib/app-info"
|
||||
import {apiConfig} from "@/lib/services"
|
||||
import {Card, CardContent, CardDescription, CardHeader, CardTitle} from "@/components/ui/card"
|
||||
|
||||
@@ -36,8 +37,8 @@ export function InfoTab({ systemConfigsLength, authSourcesLength }: InfoTabProps
|
||||
</CardHeader>
|
||||
<CardContent className="pt-4">
|
||||
<InfoRow label="应用名称" value={packageJson.name} />
|
||||
<InfoRow label="版本号" value={packageJson.version} />
|
||||
<InfoRow label="构建时间" value={packageJson.buildDate} />
|
||||
<InfoRow label="版本号" value={APP_VERSION} />
|
||||
{APP_BUILD_DATE && <InfoRow label="构建时间" value={APP_BUILD_DATE} />}
|
||||
<InfoRow label="Next.js" value={(packageJson as { dependencies?: Record<string, string> }).dependencies?.next} />
|
||||
<InfoRow label="React" value={(packageJson as { dependencies?: Record<string, string> }).dependencies?.react} />
|
||||
</CardContent>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import * as React from "react"
|
||||
import Link from "next/link"
|
||||
import {usePathname, useRouter} from "next/navigation"
|
||||
import packageJson from "../../package.json"
|
||||
import {APP_VERSION, APP_BUILD_DATE} from "@/lib/app-info"
|
||||
import {toast} from "sonner"
|
||||
import {Button} from "@/components/ui/button"
|
||||
import {Spinner} from "@/components/ui/spinner"
|
||||
@@ -384,8 +384,8 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
|
||||
</SidebarContent>
|
||||
<SidebarFooter className="mt-auto px-3 py-3 group-data-[collapsible=icon]:hidden">
|
||||
<div className="border-t border-border/60 pt-3 text-[11px] leading-5 text-muted-foreground">
|
||||
<div>Version {packageJson.version}</div>
|
||||
<div>Build At {packageJson.buildDate}</div>
|
||||
<div>Version {APP_VERSION}</div>
|
||||
{APP_BUILD_DATE && <div>Build At {APP_BUILD_DATE}</div>}
|
||||
</div>
|
||||
</SidebarFooter>
|
||||
</Sidebar>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import packageJson from "../package.json"
|
||||
|
||||
const rawVersion = process.env.NEXT_PUBLIC_APP_VERSION || packageJson.version
|
||||
|
||||
export const APP_VERSION = rawVersion.startsWith('v') ? rawVersion.slice(1) : rawVersion
|
||||
export const APP_BUILD_DATE = process.env.NEXT_PUBLIC_APP_BUILD_DATE || ""
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "wavelet",
|
||||
"version": "1.3.9",
|
||||
"buildDate": "2026-04-22 16:00:00",
|
||||
"version": "dev",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"predev": "node scripts/generate-themes.js",
|
||||
|
||||
Reference in New Issue
Block a user