Merge branch 'appli456-chore/cross-platform-script'
This commit is contained in:
commit
c1cad24790
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ resources/ocr/*.wasm
|
|||||||
resources/renderer
|
resources/renderer
|
||||||
resources/service
|
resources/service
|
||||||
*.traineddata
|
*.traineddata
|
||||||
|
.turbo
|
||||||
|
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -12,5 +12,8 @@
|
|||||||
"typescript.tsc.autoDetect": "off",
|
"typescript.tsc.autoDetect": "off",
|
||||||
|
|
||||||
"i18n-haru.root": "renderer/src/i18n",
|
"i18n-haru.root": "renderer/src/i18n",
|
||||||
"i18n-haru.main": "zh"
|
"i18n-haru.main": "zh",
|
||||||
|
"i18n-ally.localesPaths": [
|
||||||
|
"renderer/src/i18n"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
11
README.md
11
README.md
@ -145,10 +145,7 @@ B <--mcp--> m(MCP Server)
|
|||||||
启动 dev server
|
启动 dev server
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## linux
|
npm run dev
|
||||||
./dev.sh
|
|
||||||
## windows
|
|
||||||
./dev.ps1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> 端口占用: 8282 (renderer) + 8081 (service)
|
> 端口占用: 8282 (renderer) + 8081 (service)
|
||||||
@ -163,11 +160,7 @@ B <--mcp--> m(MCP Server)
|
|||||||
|
|
||||||
负载部署
|
负载部署
|
||||||
```bash
|
```bash
|
||||||
## linux
|
npm run build
|
||||||
./build_service.sh
|
|
||||||
|
|
||||||
## windows
|
|
||||||
./build_service.ps1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
and just press f5, いただきます
|
and just press f5, いただきます
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
# 安装 renderer 依赖
|
## 安装 renderer 依赖
|
||||||
Set-Location renderer
|
#Set-Location renderer
|
||||||
npm i
|
#npm i
|
||||||
Set-Location ..
|
#Set-Location ..
|
||||||
|
#
|
||||||
# 安装 service 依赖并打补丁
|
## 安装 service 依赖并打补丁
|
||||||
Set-Location service
|
#Set-Location service
|
||||||
npm i
|
#npm i
|
||||||
node patch-mcp-sdk.js
|
#node patch-mcp-sdk.js
|
||||||
Set-Location ..
|
#Set-Location ..
|
||||||
|
|
||||||
Set-Location servers
|
Set-Location servers
|
||||||
uv sync
|
uv sync
|
||||||
@ -15,3 +15,5 @@ Set-Location ..
|
|||||||
|
|
||||||
# 安装根目录依赖
|
# 安装根目录依赖
|
||||||
npm i
|
npm i
|
||||||
|
|
||||||
|
npm run prepare:ocr
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
cd renderer && npm i && cd ..
|
cd servers && uv sync && cd ..
|
||||||
cd service && npm i && cd ..
|
|
||||||
cd servers && uv sync
|
|
||||||
npm i
|
npm i
|
||||||
npm run prepare:ocr
|
npm run prepare:ocr
|
15567
package-lock.json
generated
15567
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -212,7 +212,18 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"workspaces": [
|
||||||
|
"service",
|
||||||
|
"renderer",
|
||||||
|
"software"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"dev": "turbo dev --filter=!@openmcp/electron",
|
||||||
|
"dev:electron": "turbo dev --filter=@openmcp/electron",
|
||||||
|
"dev:all": "turbo dev",
|
||||||
|
"build": "turbo build --filter=!@openmcp/electron",
|
||||||
|
"build:electron": "turbo build --filter=@openmcp/electron",
|
||||||
|
"build:all": "turbo build",
|
||||||
"vscode:prepublish": "webpack --mode production",
|
"vscode:prepublish": "webpack --mode production",
|
||||||
"compile": "tsc -p ./",
|
"compile": "tsc -p ./",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "tsc -watch -p ./",
|
||||||
@ -224,6 +235,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@modelcontextprotocol/sdk": "^1.10.2",
|
"@modelcontextprotocol/sdk": "^1.10.2",
|
||||||
|
"@openmcp/service": "*",
|
||||||
"@seald-io/nedb": "^4.1.1",
|
"@seald-io/nedb": "^4.1.1",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
"bson": "^6.8.0",
|
"bson": "^6.8.0",
|
||||||
@ -242,8 +254,10 @@
|
|||||||
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
||||||
"null-loader": "^4.0.1",
|
"null-loader": "^4.0.1",
|
||||||
"ts-loader": "^9.5.1",
|
"ts-loader": "^9.5.1",
|
||||||
|
"turbo": "^2.5.3",
|
||||||
"typescript": "^5.4.2",
|
"typescript": "^5.4.2",
|
||||||
"webpack": "^5.99.5",
|
"webpack": "^5.99.5",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
}
|
},
|
||||||
|
"packageManager": "npm@10.0.0"
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "test-vite",
|
"name": "@openmcp/renderer",
|
||||||
"version": "0.0.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"dev": "vite",
|
||||||
|
"postbuild": "node scripts/post-build.mjs",
|
||||||
|
"lint": "vue-cli-service lint",
|
||||||
"serve": "vite",
|
"serve": "vite",
|
||||||
"serve:website": "vite --mode website",
|
"serve:website": "vite --mode website",
|
||||||
"build": "run-p type-check \"build-only {@}\" --",
|
"build": "run-p type-check \"build-only {@}\" --",
|
||||||
|
43
renderer/scripts/post-build.mjs
Normal file
43
renderer/scripts/post-build.mjs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import fsPath from 'node:path';
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import * as process from "node:process";
|
||||||
|
|
||||||
|
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();
|
||||||
|
// 确保上级目录的 openmcp-sdk 存在
|
||||||
|
const openMCPSdkPath = fsPath.join(currentDir, '..', 'openmcp-sdk')
|
||||||
|
createDirIfExists(openMCPSdkPath);
|
||||||
|
|
||||||
|
const sdkRenderPath = fsPath.join(openMCPSdkPath, 'renderer');
|
||||||
|
recreateDir(sdkRenderPath);
|
||||||
|
|
||||||
|
const sourceDist = fsPath.join(currentDir, 'dist');
|
||||||
|
|
||||||
|
// 如果源目录不存在则报错
|
||||||
|
if (!fs.existsSync(sourceDist)) {
|
||||||
|
throw new Error(`Source directory not found: ${sourceDist}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.cpSync(sourceDist, sdkRenderPath, { recursive: true })
|
||||||
|
|
||||||
|
// electron目录
|
||||||
|
const electronOpenMcpSdkPath = fsPath.join(currentDir, '..', 'software', 'openmcp-sdk');
|
||||||
|
createDirIfExists(electronOpenMcpSdkPath);
|
||||||
|
|
||||||
|
const electronRendererPath = fsPath.join(electronOpenMcpSdkPath, 'renderer');
|
||||||
|
recreateDir(electronRendererPath);
|
||||||
|
|
||||||
|
fs.cpSync(sourceDist, electronRendererPath, { recursive: true })
|
5023
service/package-lock.json
generated
5023
service/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "openmcp-service",
|
"name": "@openmcp/service",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
"type": "commonjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "ts-node-dev --respawn --transpile-only src/main.ts",
|
"postinstall": "npm run build",
|
||||||
|
"dev": "ts-node-dev --respawn --transpile-only src/main.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:watch": "tsc --watch",
|
"build:watch": "tsc --watch",
|
||||||
|
"postbuild": "node ./scripts/post-build.mjs",
|
||||||
"start": "node dist/main.js",
|
"start": "node dist/main.js",
|
||||||
"start:prod": "NODE_ENV=production node dist/main.js",
|
"start:prod": "NODE_ENV=production node dist/main.js",
|
||||||
"debug": "node --inspect -r ts-node/register src/main.ts",
|
"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 })
|
@ -9,7 +9,8 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"experimentalDecorators": true
|
"experimentalDecorators": true,
|
||||||
|
"moduleResolution": "node"
|
||||||
},
|
},
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": [
|
"@/*": [
|
||||||
|
5437
software/package-lock.json
generated
5437
software/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "openmcp-electron",
|
"name": "@openmcp/electron",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/main.js",
|
"main": "dist/main.js",
|
||||||
@ -13,6 +13,7 @@
|
|||||||
"email": "1193466151@qq.com"
|
"email": "1193466151@qq.com"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@openmcp/service": "*",
|
||||||
"@modelcontextprotocol/sdk": "^1.10.2",
|
"@modelcontextprotocol/sdk": "^1.10.2",
|
||||||
"@seald-io/nedb": "^4.1.1",
|
"@seald-io/nedb": "^4.1.1",
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as OpenMCPService from '../openmcp-sdk/service';
|
import * as OpenMCPService from '@openmcp/service';
|
||||||
import { launch } from './common/entry';
|
import { launch } from './common/entry';
|
||||||
|
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
|
@ -2,7 +2,7 @@ import * as vscode from 'vscode';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as fspath from 'path';
|
import * as fspath from 'path';
|
||||||
import { IConnectionItem, ILaunchSigature, panels, updateInstalledConnectionConfig, updateWorkspaceConnectionConfig } from '../global';
|
import { IConnectionItem, ILaunchSigature, panels, updateInstalledConnectionConfig, updateWorkspaceConnectionConfig } from '../global';
|
||||||
import * as OpenMCPService from '../../openmcp-sdk/service';
|
import * as OpenMCPService from '@openmcp/service';
|
||||||
|
|
||||||
export function getWebviewContent(context: vscode.ExtensionContext, panel: vscode.WebviewPanel): string | undefined {
|
export function getWebviewContent(context: vscode.ExtensionContext, panel: vscode.WebviewPanel): string | undefined {
|
||||||
const viewRoot = fspath.join(context.extensionPath, 'openmcp-sdk', 'renderer');
|
const viewRoot = fspath.join(context.extensionPath, 'openmcp-sdk', 'renderer');
|
||||||
|
22
turbo.json
Normal file
22
turbo.json
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://turborepo.com/schema.json",
|
||||||
|
"tasks": {
|
||||||
|
"dev": {
|
||||||
|
"persistent": true,
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"outputs": ["dist/**"]
|
||||||
|
},
|
||||||
|
"@openmcp/electron#dev": {
|
||||||
|
"dependsOn": ["@openmcp/renderer#build", "@openmcp/service#build"],
|
||||||
|
"persistent": true,
|
||||||
|
"cache": false
|
||||||
|
},
|
||||||
|
"@openmcp/electron#build": {
|
||||||
|
"dependsOn": ["@openmcp/renderer#build", "@openmcp/service#build"],
|
||||||
|
"outputs": ["dist/**"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user