refactor: 简化项目配置,改用环境变量端口并专注 MSI 发布

- 重命名项目为 openbridgeTokenUsageViewer (camelCase 风格)
- 移除 DJB2 hash 端口计算,改用 PROJECT_SERVER_PORT 环境变量 (默认 3000)
- 删除 src/lib/project-port.ts 冗余模块
- 打包目标从 "all" 改为 "msi",专注 Windows 安装程序发布
This commit is contained in:
2026-01-22 14:19:43 +08:00
parent b520cdaf35
commit fa625ca301
11 changed files with 39 additions and 117 deletions

View File

@@ -12,6 +12,9 @@ import { z } from 'zod'
/** Token 使用量 API 的默认地址 */
const DEFAULT_TOKEN_USAGE_URL = 'http://10.0.1.1:8318/usage'
/** 服务器端口默认值 */
const DEFAULT_SERVER_PORT = '3000'
/**
* 判断当前是否为打包后的可执行文件运行环境
*
@@ -109,6 +112,7 @@ const buildMergedEnv = (): Record<string, string | undefined> => {
// 设置默认值
merged.TOKEN_USAGE_URL ??= DEFAULT_TOKEN_USAGE_URL
merged.PROJECT_SERVER_PORT ??= DEFAULT_SERVER_PORT
return merged
}
@@ -125,6 +129,12 @@ const buildMergedEnv = (): Record<string, string | undefined> => {
export const env = createEnv({
server: {
TOKEN_USAGE_URL: z.string().url(),
PROJECT_SERVER_PORT: z.coerce
.number()
.int()
.min(1)
.max(65535)
.default(3000),
},
clientPrefix: 'VITE_',
client: {