feat: frontend 架构基座(横切层 + 接通 tailwind)
- 横切层:utils/logger(统一日志,禁 console.log)、services/wsClient(通用 WS 客户端)、 components/ErrorBoundary(错误边界);main.tsx 接 ErrorBoundary + Toaster - 接通 tailwind:补 tailwind.config.js + postcss.config.js + @tailwind 指令 (此前 tailwindcss/postcss/autoprefixer 是悬空依赖,无配置) - vite-env.d.ts:VITE_ 环境变量类型(按 include_backend 渲染) - App.tsx 改用 tailwind utility class(规则禁自定义 CSS) - 验证:build/lint/typecheck 三门禁全过 至此三服务架构基座完成:copier 预生成横切层,每个生成项目第一天即结构完整、能跑、过门禁。
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// 统一前端日志:dev 输出 console,prod 可接 Sentry。
|
||||
// 禁止在组件/hooks 直接用 console.log(见 .claude/rules/frontend-runtime.md)。
|
||||
export const logger = {
|
||||
info: (msg: string, ctx?: object): void => {
|
||||
// eslint-disable-next-line no-console
|
||||
if (import.meta.env.DEV) console.info(`[INFO] ${msg}`, ctx ?? "");
|
||||
},
|
||||
warn: (msg: string, ctx?: object): void => {
|
||||
console.warn(`[WARN] ${msg}`, ctx ?? "");
|
||||
},
|
||||
error: (msg: string, ctx?: object): void => {
|
||||
console.error(`[ERROR] ${msg}`, ctx ?? "");
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user