feat: 添加环境变量管理与通用工具支持

- 添加 @t3-oss/env-core 依赖并指定其版本及对 peerDependencies 和 optionalPeers 的要求
- 添加 OpenCode 配置文件,定义本地和远程 MCP 服务以支持 shadcn 和 tanstack 工具集成。
- 添加 @t3-oss/env-core 依赖以支持环境变量配置管理
- 使用 t3-oss/env-core 创建环境变量配置,支持服务器和客户端环境变量解析,并启用空字符串转为 undefined。
- 添加工具函数库以支持项目中的通用功能需求
This commit is contained in:
2026-01-17 02:12:10 +08:00
parent 037df221d4
commit ccc05a8ee8
5 changed files with 28 additions and 4 deletions

View File

@@ -1,7 +1,14 @@
import { createEnv } from '@t3-oss/env-core'
import { z } from 'zod'
const envSchema = z.object({
DATABASE_URL: z.url(),
export const env = createEnv({
server: {
DATABASE_URL: z.url(),
},
clientPrefix: 'VITE_',
client: {
VITE_APP_TITLE: z.string().min(1).optional(),
},
runtimeEnv: import.meta.env,
emptyStringAsUndefined: true,
})
export const env = envSchema.parse(process.env)