日志模块(文件持久化 + 事件总线联动 + 脱敏)
新增:
- shared/types/logging.ts — LogLevel / LogCategory / LogEntry 类型
- electron/main/logger.ts — 主进程日志核心(JSON Lines / 每日轮转 / 7天清理)
- electron/main/log-ipc.ts — 渲染进程日志 IPC 通道接收
- src/utils/logger.ts — 渲染进程日志器(IPC 转发 / DEV 控制台 / 事件总线钩子)
- shared/utils/sanitize.ts — 脱敏工具(ID哈希 / 邮箱 / 手机 / 名称 / Token)
修改:
- electron/main.ts — initLogger + flushLogger + uncaughtException
- src/main.tsx — renderer 全局错误捕获
- src/utils/event-bus.ts — setEventLogListener 钩子,emit 自动审计
- src/services/request.ts — 拦截器结构化错误分级记录
- electron/main/updater.ts — 14处 console → logger 迁移
- src/components/AppProvider.tsx — 登录/登出/自动登录 auth 事件日志
- shared/constants/ipc-channels.ts — 新增 LOG_MESSAGE 通道
netRequest 封装(Electron net.request 的 axios 风格 API)
新增:
- electron/main/net-request.ts — netRequest.get/post/put/del 命名空间
修改:
- electron/main/updater.ts — fetchUpdateInfo 改用 netRequest(22→12行)
文档更新
- PROJECT.md — 目录结构 / 状态管理 / 日志系统 / IPC 章节同步现状
- TODO.md — 增量更新改造 + 日志模块待办
- UpdateA.md — API blockmap 字段 / 数据库字段说明
118 lines
4.0 KiB
JSON
118 lines
4.0 KiB
JSON
{
|
|
"name": "ele-heixiu",
|
|
"private": true,
|
|
"version": "0.0.1",
|
|
"description": "船长·HeiXiu — 桌面效率工作台",
|
|
"author": "HeiXiu 杨烨",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "chcp 65001 > null && cross-env ELECTRON_MIRROR=https://npmmirror.com/mirrors/electron/ vite",
|
|
"build": "node build.mjs --win --personal --build",
|
|
"build:win": "node build.mjs --win --personal --build",
|
|
"build:win:enterprise": "node build.mjs --win --enterprise --build",
|
|
"build:mac": "node build.mjs --mac --personal --build",
|
|
"build:mac:enterprise": "node build.mjs --mac --enterprise --build",
|
|
"build:linux": "node build.mjs --linux --personal --build",
|
|
"build:linux:enterprise": "node build.mjs --linux --enterprise --build",
|
|
"build:clean": "node scripts/clean.mjs",
|
|
"upload:oss": "node scripts/upload-oss.mjs",
|
|
"publish:release": "node scripts/publish-release.mjs",
|
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
"preview": "vite preview",
|
|
"format": "prettier --write \"src/**/*.{ts,tsx,css}\" \"electron/**/*.ts\" \"shared/**/*.ts\"",
|
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,css}\" \"electron/**/*.ts\" \"shared/**/*.ts\"",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test:e2e": "playwright test.json"
|
|
},
|
|
"dependencies": {
|
|
"antd": "^6.4.3",
|
|
"axios": "^1.16.1",
|
|
"react": "^19.2.7",
|
|
"react-dom": "^19.2.7",
|
|
"react-router-dom": "^7.16.0"
|
|
},
|
|
"build": {
|
|
"appId": "com.heixiu.electron",
|
|
"productName": "船长·HeiXiu",
|
|
"asar": true,
|
|
"differential": true,
|
|
"directories": {
|
|
"output": "release/${version}"
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"dist-electron"
|
|
],
|
|
"electronDownload": {
|
|
"mirror": "https://npmmirror.com/mirrors/electron/"
|
|
},
|
|
"publish": {
|
|
"provider": "generic",
|
|
"url": "https://update.heixiu.com"
|
|
},
|
|
"win": {
|
|
"icon": "src/assets/logo/heixiu.ico",
|
|
"target": [
|
|
{
|
|
"target": "NSIS",
|
|
"arch": [
|
|
"x64"
|
|
]
|
|
}
|
|
],
|
|
"artifactName": "${productName}-Windows-${version}-${env.EDITION}-Setup.${ext}"
|
|
},
|
|
"mac": {
|
|
"icon": "src/assets/logo/heixiu.icns",
|
|
"target": [
|
|
"dmg"
|
|
],
|
|
"artifactName": "${productName}-Mac-${version}-${env.EDITION}-Installer.${ext}"
|
|
},
|
|
"linux": {
|
|
"icon": "src/assets/logo/HX.png",
|
|
"target": [
|
|
"AppImage"
|
|
],
|
|
"artifactName": "${productName}-Linux-${version}-${env.EDITION}.${ext}"
|
|
},
|
|
"nsis": {
|
|
"oneClick": false,
|
|
"perMachine": false,
|
|
"allowToChangeInstallationDirectory": true,
|
|
"deleteAppDataOnUninstall": false,
|
|
"installerIcon": "src/assets/logo/heixiu.ico",
|
|
"uninstallerIcon": "src/assets/logo/heixiu.ico"
|
|
}
|
|
},
|
|
"devDependencies": {
|
|
"@playwright/test": "^1.60.0",
|
|
"@tailwindcss/vite": "^4.3.0",
|
|
"@types/electron": "^1.4.38",
|
|
"@types/node": "^25.9.1",
|
|
"@types/react": "^19.2.16",
|
|
"@types/react-dom": "^19.2.3",
|
|
"@typescript-eslint/eslint-plugin": "^8.60.1",
|
|
"@typescript-eslint/parser": "^8.60.1",
|
|
"@vitejs/plugin-react": "^6.0.0",
|
|
"autoprefixer": "^10.5.0",
|
|
"cross-env": "^10.1.0",
|
|
"electron": "42.3.0",
|
|
"electron-builder": "^26.8.1",
|
|
"eslint": "^10.4.1",
|
|
"eslint-config-prettier": "^10.1.8",
|
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
"eslint-plugin-react-refresh": "^0.5.2",
|
|
"postcss": "^8.5.15",
|
|
"prettier": "^3.8.3",
|
|
"rollup-plugin-visualizer": "^7.0.1",
|
|
"tailwindcss": "^4.3.0",
|
|
"typescript": "^6.0.3",
|
|
"vite": "8.0.16",
|
|
"vite-plugin-electron": "^1.0.0",
|
|
"vite-plugin-electron-renderer": "^1.0.0"
|
|
},
|
|
"main": "dist-electron/main.js"
|
|
}
|