This commit is contained in:
2026-04-08 21:26:18 +08:00
commit 8fdc7ac0c3
401 changed files with 53093 additions and 0 deletions

3
apps/web/.env Normal file
View File

@@ -0,0 +1,3 @@
# 默认环境变量配置(会被 .env.development 和 .env.production 覆盖)
# VITE_API_BASE_URL=https://cslab.oberyun.com
VITE_API_BASE_URL=http://192.168.1.110:8001

View File

@@ -0,0 +1,2 @@
# 开发环境配置
VITE_API_BASE_URL=http://192.168.1.110:8001

2
apps/web/.env.production Normal file
View File

@@ -0,0 +1,2 @@
# 生产环境配置
VITE_API_BASE_URL=https://cslab.oberyun.com

View File

@@ -0,0 +1,3 @@
{
"globals": {}
}

13
apps/web/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DCS Editor (Web)</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

24
apps/web/package.json Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "@cslab-dcs/web",
"type": "module",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "vite --host",
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview",
"typecheck": "vue-tsc --noEmit"
},
"dependencies": {
"@cslab-dcs/bridge": "workspace:*",
"@cslab-dcs/core": "workspace:*",
"vue": "^3.5.13"
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"typescript": "^5.9.3",
"vite": "^6.0.3",
"vue-tsc": "^2.2.0"
}
}

16
apps/web/src/env.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
/// <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<object, object, any>
export default component
}
interface ImportMetaEnv {
readonly VITE_API_BASE_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}

5
apps/web/src/main.ts Normal file
View File

@@ -0,0 +1,5 @@
import { bridge } from '@cslab-dcs/bridge'
import { createDCSApp } from '@cslab-dcs/core'
const app = createDCSApp(bridge)
app.mount('#app')

24
apps/web/tsconfig.json Normal file
View File

@@ -0,0 +1,24 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["../../packages/core/src/*"],
"@cslab-dcs/core": ["../../packages/core/src"],
"@cslab-dcs/bridge": ["../../packages/bridge/src"],
"@cslab-dcs/schema": ["../../packages/schema/src"]
},
"types": ["element-plus/global"]
},
"include": [
"src/**/*",
"../../packages/core/src/**/*",
"../../packages/core/src/auto-imports.d.ts",
"../../packages/core/env.d.ts",
"../../packages/bridge/src/**/*",
"../../packages/request/src/**/*",
"../../packages/schema/src/**/*",
"../../packages/utils/src/**/*"
],
"exclude": ["node_modules", "dist"]
}

31
apps/web/unocss.config.ts Normal file
View File

@@ -0,0 +1,31 @@
import {
defineConfig,
presetAttributify,
presetIcons,
presetTypography,
presetUno,
transformerDirectives,
transformerVariantGroup,
} from 'unocss'
import presetChinese from 'unocss-preset-chinese'
import presetEase from 'unocss-preset-ease'
export default defineConfig({
presets: [
presetUno(),
presetAttributify(),
presetChinese(),
presetEase(),
presetTypography(),
presetIcons({
scale: 1.2,
warn: true,
}),
],
shortcuts: [
['flex-center', 'flex items-center justify-center'],
['flex-between', 'flex items-center justify-between'],
['flex-end', 'flex items-end justify-between'],
],
transformers: [transformerDirectives(), transformerVariantGroup()],
})

25
apps/web/vite.config.ts Normal file
View File

@@ -0,0 +1,25 @@
import type { UserConfig } from 'vite'
import { resolve } from 'node:path'
import { defineConfig, loadEnv, mergeConfig } from 'vite'
import { createSharedViteConfig } from '../../packages/core/vite.shared'
// Core 包的根目录
const coreRoot = resolve(__dirname, '../../packages/core')
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, coreRoot, 'VITE_')
const sharedConfig = createSharedViteConfig(coreRoot, env) as UserConfig
return mergeConfig(sharedConfig, {
root: __dirname,
base: env.VITE_BASE_URL, // 确保相对路径,方便部署
build: {
outDir: 'dist',
emptyOutDir: true,
},
server: {
port: 5173,
},
})
})