mirror of
https://github.com/Afilmory/afilmory
synced 2026-04-24 23:05:05 +00:00
feat(config): introduce site configuration file and update references
- Added a new site.config.ts file to manage site configuration, merging default settings with user-defined options. - Updated import paths in tsconfig.json files for both SSR and web applications to reference the new site.config.ts. - Modified usage of siteConfig in route.tsx and ActionGroup.tsx to ensure compatibility with the new configuration structure. - Removed the old site configuration export from config/site.config.ts. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -339,7 +339,7 @@ export const GET = async (
|
||||
fontFamily: 'Geist, SF Pro Display',
|
||||
}}
|
||||
>
|
||||
{photo.description || siteConfig.name || site.title}
|
||||
{photo.description || siteConfig.name || siteConfig.title}
|
||||
</p>
|
||||
|
||||
{/* 标签 */}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
],
|
||||
"paths": {
|
||||
"@config": [
|
||||
"../../config/site.config.ts"
|
||||
"../../site.config.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -48,7 +48,7 @@ export const ActionGroup = () => {
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
{siteConfig.extra.accessRepo && (
|
||||
{siteConfig.extra?.accessRepo && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"./package.json"
|
||||
],
|
||||
"@config": [
|
||||
"../../config/site.config.ts"
|
||||
"../../site.config.ts"
|
||||
],
|
||||
"@builder": [
|
||||
"../../builder.config.ts"
|
||||
|
||||
@@ -10,10 +10,10 @@ import { checker } from 'vite-plugin-checker'
|
||||
import { createHtmlPlugin } from 'vite-plugin-html'
|
||||
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
|
||||
import { siteConfig } from '../../config/site.config'
|
||||
import PKG from '../../package.json'
|
||||
import { ogImagePlugin } from '../../plugins/og-image-plugin'
|
||||
import { createDependencyChunksPlugin } from '../../plugins/vite/deps'
|
||||
import { siteConfig } from '../../site.config'
|
||||
|
||||
if (process.env.CI) {
|
||||
rmSync(path.join(process.cwd(), 'src/pages/(debug)'), {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { default as siteConfig } from '../config.json'
|
||||
45
site.config.ts
Normal file
45
site.config.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { merge } from 'es-toolkit/compat'
|
||||
|
||||
import userConfig from './config.json'
|
||||
|
||||
interface SiteConfig {
|
||||
name: string
|
||||
title: string
|
||||
description: string
|
||||
url: string
|
||||
accentColor: string
|
||||
author: Author
|
||||
social?: Social
|
||||
extra?: Extra
|
||||
}
|
||||
interface Author {
|
||||
name: string
|
||||
url: string
|
||||
avatar?: string
|
||||
}
|
||||
interface Social {
|
||||
twitter: string
|
||||
}
|
||||
interface Extra {
|
||||
accessRepo: boolean
|
||||
}
|
||||
|
||||
const defaultConfig: SiteConfig = {
|
||||
name: "Innei's Photo Gallery",
|
||||
title: "Innei's Photo Gallery",
|
||||
description:
|
||||
'Capturing beautiful moments in life, documenting daily warmth and emotions through my lens.',
|
||||
url: 'https://gallery.innei.in',
|
||||
accentColor: '#007bff',
|
||||
author: {
|
||||
name: 'Photo Gallery',
|
||||
url: 'https://innei.in/',
|
||||
avatar: '//cdn.jsdelivr.net/gh/Innei/static@master/avatar.png',
|
||||
},
|
||||
social: {
|
||||
twitter: '@__oQuery',
|
||||
},
|
||||
}
|
||||
export const siteConfig: SiteConfig = merge(defaultConfig, userConfig) as any
|
||||
|
||||
export default siteConfig
|
||||
Reference in New Issue
Block a user