fix(web): restructure client as standalone Vite project

- client/ now has its own package.json (independent Vite project)
- Tailwind + PostCSS config inlined into vite.config.ts
- dev:client uses `cd client && npm run dev` (CWD = Vite root)
- Root package.json only has server deps
- Fix tsconfig deprecation (remove baseUrl)
- Add `npm run setup` for one-command install

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 03:36:22 +08:00
parent c257dd2b8c
commit 2859fa3f2c
10 changed files with 2935 additions and 2808 deletions

2843
web/client/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

31
web/client/package.json Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "meitu-agent-client",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"dependencies": {
"react": "^18.3.0",
"react-dom": "^18.3.0",
"zustand": "^5.0.0",
"lucide-react": "^0.460.0",
"clsx": "^2.1.0",
"tailwind-merge": "^2.6.0",
"class-variance-authority": "^0.7.1",
"markdown-it": "^14.1.0"
},
"devDependencies": {
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/markdown-it": "^14.1.0",
"@vitejs/plugin-react": "^4.3.0",
"vite": "^5.4.0",
"tailwindcss": "^3.4.0",
"postcss": "^8.4.0",
"autoprefixer": "^10.4.0",
"typescript": "^5.6.0"
}
}

View File

@@ -1,6 +0,0 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

View File

@@ -1,43 +0,0 @@
import type { Config } from 'tailwindcss';
export default {
content: ['./src/**/*.{ts,tsx}'],
darkMode: 'class',
theme: {
extend: {
colors: {
border: 'hsl(240 3.7% 15.9%)',
input: 'hsl(240 3.7% 15.9%)',
ring: 'hsl(240 4.9% 83.9%)',
background: 'hsl(240 10% 3.9%)',
foreground: 'hsl(0 0% 98%)',
primary: {
DEFAULT: 'hsl(0 0% 98%)',
foreground: 'hsl(240 5.9% 10%)',
},
secondary: {
DEFAULT: 'hsl(240 3.7% 15.9%)',
foreground: 'hsl(0 0% 98%)',
},
muted: {
DEFAULT: 'hsl(240 3.7% 15.9%)',
foreground: 'hsl(240 5% 64.9%)',
},
accent: {
DEFAULT: 'hsl(240 3.7% 15.9%)',
foreground: 'hsl(0 0% 98%)',
},
destructive: {
DEFAULT: 'hsl(0 62.8% 30.6%)',
foreground: 'hsl(0 0% 98%)',
},
},
borderRadius: {
lg: '0.5rem',
md: 'calc(0.5rem - 2px)',
sm: 'calc(0.5rem - 4px)',
},
},
},
plugins: [],
} satisfies Config;

View File

@@ -4,7 +4,6 @@
"jsx": "react-jsx",
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}

View File

@@ -1,15 +1,64 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import tailwindcss from 'tailwindcss';
import autoprefixer from 'autoprefixer';
export default defineConfig({
plugins: [react()],
root: path.resolve(__dirname),
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
css: {
postcss: {
plugins: [
tailwindcss({
content: ['./index.html', './src/**/*.{ts,tsx}'],
darkMode: 'class',
theme: {
extend: {
colors: {
border: 'hsl(240 3.7% 15.9%)',
input: 'hsl(240 3.7% 15.9%)',
ring: 'hsl(240 4.9% 83.9%)',
background: 'hsl(240 10% 3.9%)',
foreground: 'hsl(0 0% 98%)',
primary: {
DEFAULT: 'hsl(0 0% 98%)',
foreground: 'hsl(240 5.9% 10%)',
},
secondary: {
DEFAULT: 'hsl(240 3.7% 15.9%)',
foreground: 'hsl(0 0% 98%)',
},
muted: {
DEFAULT: 'hsl(240 3.7% 15.9%)',
foreground: 'hsl(240 5% 64.9%)',
},
accent: {
DEFAULT: 'hsl(240 3.7% 15.9%)',
foreground: 'hsl(0 0% 98%)',
},
destructive: {
DEFAULT: 'hsl(0 62.8% 30.6%)',
foreground: 'hsl(0 0% 98%)',
},
},
borderRadius: {
lg: '0.5rem',
md: 'calc(0.5rem - 2px)',
sm: 'calc(0.5rem - 4px)',
},
},
},
plugins: [],
}),
autoprefixer(),
],
},
},
server: {
port: 5173,
proxy: {

Binary file not shown.

Binary file not shown.

2737
web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,44 +4,27 @@
"private": true,
"scripts": {
"dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
"predev:server": "npx kill-port 3007",
"dev:server": "tsx watch server/index.ts",
"dev:client": "vite --config client/vite.config.ts",
"build": "vite build --config client/vite.config.ts",
"db:init": "tsx server/db/schema.ts"
"dev:server": "npx kill-port 3007 && tsx watch server/index.ts",
"dev:client": "cd client && npm run dev",
"build": "cd client && npm run build",
"db:init": "tsx server/db/schema.ts",
"setup": "npm install && cd client && npm install"
},
"dependencies": {
"@anthropic-ai/sdk": "^0.95.0",
"better-sqlite3": "^11.6.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.0",
"cors": "^2.8.5",
"express": "^4.21.0",
"lucide-react": "^0.460.0",
"markdown-it": "^14.1.1",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"tailwind-merge": "^2.6.0",
"ws": "^8.18.0",
"zod": "^3.23.0",
"zustand": "^5.0.0"
"ws": "^8.18.0"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.0",
"@types/cors": "^2.8.0",
"@types/express": "^5.0.0",
"@types/markdown-it": "^14.1.2",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/ws": "^8.5.0",
"@vitejs/plugin-react": "^4.3.0",
"autoprefixer": "^10.4.0",
"concurrently": "^9.1.0",
"kill-port": "^2.0.1",
"postcss": "^8.4.0",
"tailwindcss": "^3.4.0",
"tsx": "^4.19.0",
"typescript": "^5.6.0",
"vite": "^5.4.0"
"typescript": "^5.6.0"
}
}