chore: service模块给electron继续使用原编译方案;修改文档
This commit is contained in:
parent
7c30463062
commit
e72b03a995
11
README.md
11
README.md
@ -145,10 +145,7 @@ B <--mcp--> m(MCP Server)
|
||||
启动 dev server
|
||||
|
||||
```bash
|
||||
## linux
|
||||
./dev.sh
|
||||
## windows
|
||||
./dev.ps1
|
||||
npm run dev
|
||||
```
|
||||
|
||||
> 端口占用: 8080 (renderer) + 8081 (service)
|
||||
@ -163,11 +160,7 @@ B <--mcp--> m(MCP Server)
|
||||
|
||||
负载部署
|
||||
```bash
|
||||
## linux
|
||||
./build_service.sh
|
||||
|
||||
## windows
|
||||
./build_service.ps1
|
||||
npm run build
|
||||
```
|
||||
|
||||
and just press f5, いただきます
|
||||
|
@ -1,13 +1,13 @@
|
||||
# 安装 renderer 依赖
|
||||
Set-Location renderer
|
||||
npm i
|
||||
Set-Location ..
|
||||
|
||||
# 安装 service 依赖并打补丁
|
||||
Set-Location service
|
||||
npm i
|
||||
node patch-mcp-sdk.js
|
||||
Set-Location ..
|
||||
## 安装 renderer 依赖
|
||||
#Set-Location renderer
|
||||
#npm i
|
||||
#Set-Location ..
|
||||
#
|
||||
## 安装 service 依赖并打补丁
|
||||
#Set-Location service
|
||||
#npm i
|
||||
#node patch-mcp-sdk.js
|
||||
#Set-Location ..
|
||||
|
||||
Set-Location servers
|
||||
uv sync
|
||||
@ -15,3 +15,5 @@ Set-Location ..
|
||||
|
||||
# 安装根目录依赖
|
||||
npm i
|
||||
|
||||
npm run prepare:ocr
|
||||
|
@ -1,5 +1,3 @@
|
||||
cd renderer && npm i && cd ..
|
||||
cd service && npm i && cd ..
|
||||
cd servers && uv sync
|
||||
cd servers && uv sync && cd ..
|
||||
npm i
|
||||
npm run prepare:ocr
|
@ -10,6 +10,7 @@
|
||||
"dev": "ts-node-dev --respawn --transpile-only src/main.ts",
|
||||
"build": "tsc",
|
||||
"build:watch": "tsc --watch",
|
||||
"postbuild": "node ./scripts/post-build.mjs",
|
||||
"start": "node dist/main.js",
|
||||
"start:prod": "NODE_ENV=production node dist/main.js",
|
||||
"debug": "node --inspect -r ts-node/register src/main.ts",
|
||||
|
33
service/scripts/post-build.mjs
Normal file
33
service/scripts/post-build.mjs
Normal file
@ -0,0 +1,33 @@
|
||||
import fs from "node:fs";
|
||||
import process from "node:process";
|
||||
import fsPath from "node:path";
|
||||
|
||||
function createDirIfExists(filePath) {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
fs.mkdirSync(filePath, { recursive: true })
|
||||
}
|
||||
}
|
||||
|
||||
function recreateDir(filePath) {
|
||||
if (fs.existsSync(filePath)) {
|
||||
fs.rmSync(filePath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
fs.mkdirSync(filePath, { recursive: true });
|
||||
}
|
||||
|
||||
const currentDir = process.cwd();
|
||||
const sourceDist = fsPath.join(currentDir, 'dist');
|
||||
|
||||
// 如果源目录不存在则报错
|
||||
if (!fs.existsSync(sourceDist)) {
|
||||
throw new Error(`Source directory not found: ${sourceDist}`)
|
||||
}
|
||||
// electron目录
|
||||
const electronOpenMcpSdkPath = fsPath.join(currentDir, '..', 'software', 'openmcp-sdk');
|
||||
createDirIfExists(electronOpenMcpSdkPath);
|
||||
|
||||
const electronServicePath = fsPath.join(electronOpenMcpSdkPath, 'service');
|
||||
recreateDir(electronServicePath);
|
||||
|
||||
fs.cpSync(sourceDist, electronServicePath, { recursive: true })
|
@ -1,5 +1,5 @@
|
||||
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
import * as OpenMCPService from '@openmcp/service';
|
||||
import * as OpenMCPService from '../openmcp-sdk/service';
|
||||
import * as path from 'path';
|
||||
import { ElectronIPCLike, getInitConnectionOption, ILaunchSigature, updateConnectionOption } from './util';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user