commit
eab59e4ba1
9
.github/workflows/build.yaml
vendored
9
.github/workflows/build.yaml
vendored
@ -4,6 +4,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- dev
|
||||||
|
- hotfix
|
||||||
|
- hotfix/*
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
@ -23,13 +26,13 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22.x'
|
node-version: '22.x'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build all
|
- name: Build all
|
||||||
run: npm run build
|
run: yarn build
|
||||||
|
|
||||||
- name: Package VSIX
|
- name: Package VSIX
|
||||||
run: npx vsce package --out dist/openmcp.vsix
|
run: npx vsce package --out dist/openmcp.vsix
|
||||||
|
11
.github/workflows/test.yaml
vendored
11
.github/workflows/test.yaml
vendored
@ -4,6 +4,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- dev
|
||||||
|
- hotfix
|
||||||
|
- hotfix/*
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
@ -23,10 +26,10 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22.x'
|
node-version: '22.x'
|
||||||
cache: 'npm'
|
cache: 'yarn'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
- name: Install xvfb (Linux only)
|
- name: Install xvfb (Linux only)
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
@ -34,8 +37,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Test with XVFB (Linux)
|
- name: Run Test with XVFB (Linux)
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: xvfb-run --auto-servernum npm run test
|
run: xvfb-run --auto-servernum yarn test
|
||||||
|
|
||||||
- name: Run Test (Windows/macOS)
|
- name: Run Test (Windows/macOS)
|
||||||
if: runner.os != 'Linux'
|
if: runner.os != 'Linux'
|
||||||
run: npm run test
|
run: yarn test
|
@ -8,9 +8,13 @@ build({
|
|||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
outfile: 'dist/extension.cjs.js',
|
outfile: 'dist/extension.cjs.js',
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
external: ['vscode'], // 只排除 vscode,其他依赖全部打包进来
|
external: ['vscode'],
|
||||||
target: ['node18'], // 你可以根据实际 node 版本调整
|
target: ['node22'],
|
||||||
loader: {
|
loader: {
|
||||||
'.json': 'json'
|
'.json': 'json'
|
||||||
}
|
},
|
||||||
|
define: { 'import.meta.url': '_importMetaUrl' },
|
||||||
|
banner: {
|
||||||
|
js: "const _importMetaUrl=require('url').pathToFileURL(__filename)",
|
||||||
|
},
|
||||||
}).catch(() => process.exit(1));
|
}).catch(() => process.exit(1));
|
11875
package-lock.json
generated
11875
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -4,6 +4,7 @@
|
|||||||
"description": "An all in one MCP Client/TestTool",
|
"description": "An all in one MCP Client/TestTool",
|
||||||
"version": "0.1.8",
|
"version": "0.1.8",
|
||||||
"publisher": "kirigaya",
|
"publisher": "kirigaya",
|
||||||
|
"private": true,
|
||||||
"author": {
|
"author": {
|
||||||
"name": "kirigaya",
|
"name": "kirigaya",
|
||||||
"email": "1193466151@qq.com"
|
"email": "1193466151@qq.com"
|
||||||
@ -220,14 +221,14 @@
|
|||||||
"renderer"
|
"renderer"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i && npm run prepare:ocr",
|
"setup": "yarn install && yarn prepare:ocr",
|
||||||
"serve": "turbo serve",
|
"serve": "turbo serve",
|
||||||
"build": "turbo build && tsc -p ./ && node esbuild.config.js",
|
"build": "turbo build && tsc -p ./ && node esbuild.config.js",
|
||||||
"build:plugin": "npm run build && tsc && vsce package",
|
"build:plugin": "yarn build && tsc && vsce package",
|
||||||
"vscode:prepublish": "node esbuild.config.js",
|
"vscode:prepublish": "node esbuild.config.js",
|
||||||
"compile": "tsc -p ./",
|
"compile": "tsc -p ./",
|
||||||
"watch": "tsc -watch -p ./",
|
"watch": "tsc -watch -p ./",
|
||||||
"pretest": "npm run build",
|
"pretest": "yarn build",
|
||||||
"lint": "eslint src --ext ts",
|
"lint": "eslint src --ext ts",
|
||||||
"test": "node ./dist/test/e2e/runTest.js",
|
"test": "node ./dist/test/e2e/runTest.js",
|
||||||
"prepare:ocr": "rollup -c rollup.tesseract.js --bundleConfigAsCjs",
|
"prepare:ocr": "rollup -c rollup.tesseract.js --bundleConfigAsCjs",
|
||||||
@ -265,6 +266,7 @@
|
|||||||
"@types/node": "^22.15.29",
|
"@types/node": "^22.15.29",
|
||||||
"@types/pako": "^2.0.3",
|
"@types/pako": "^2.0.3",
|
||||||
"@types/showdown": "^2.0.0",
|
"@types/showdown": "^2.0.0",
|
||||||
|
"@types/sinon": "^17.0.4",
|
||||||
"@types/vscode": "^1.72.0",
|
"@types/vscode": "^1.72.0",
|
||||||
"@vscode/test-cli": "^0.0.11",
|
"@vscode/test-cli": "^0.0.11",
|
||||||
"@vscode/test-electron": "^2.5.2",
|
"@vscode/test-electron": "^2.5.2",
|
||||||
@ -275,6 +277,7 @@
|
|||||||
"rollup": "^4.43.0",
|
"rollup": "^4.43.0",
|
||||||
"rollup-plugin-copy": "^3.5.0",
|
"rollup-plugin-copy": "^3.5.0",
|
||||||
"rollup-plugin-visualizer": "^6.0.1",
|
"rollup-plugin-visualizer": "^6.0.1",
|
||||||
|
"sinon": "^21.0.0",
|
||||||
"ts-loader": "^9.5.1",
|
"ts-loader": "^9.5.1",
|
||||||
"turbo": "^2.5.3",
|
"turbo": "^2.5.3",
|
||||||
"typescript": "^5.4.2",
|
"typescript": "^5.4.2",
|
||||||
@ -286,5 +289,5 @@
|
|||||||
"webpack": "^5.99.5",
|
"webpack": "^5.99.5",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
},
|
},
|
||||||
"packageManager": "npm@10.0.0"
|
"packageManager": "yarn@1.22.22"
|
||||||
}
|
}
|
@ -62,5 +62,7 @@
|
|||||||
"vite": "^6.2.4",
|
"vite": "^6.2.4",
|
||||||
"vite-plugin-vue-devtools": "^7.7.2",
|
"vite-plugin-vue-devtools": "^7.7.2",
|
||||||
"vue-tsc": "^2.2.8"
|
"vue-tsc": "^2.2.8"
|
||||||
}
|
},
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
4633
service/package-lock.json
generated
4633
service/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -6,13 +6,13 @@
|
|||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "nodemon --watch src --exec tsx src/main.ts",
|
"serve": "tsx watch src/main.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"build:watch": "tsc --watch",
|
"build:watch": "tsc --watch",
|
||||||
"postbuild": "node ./scripts/post-build.mjs",
|
"postbuild": "node ./scripts/post-build.mjs",
|
||||||
"start": "node --experimental-specifier-resolution=node dist/main.js",
|
"start": "node dist/main.js",
|
||||||
"start:prod": "NODE_ENV=production node --experimental-specifier-resolution=node dist/main.js",
|
"start:prod": "NODE_ENV=production node dist/main.js",
|
||||||
"debug": "node --inspect --no-warnings=ExperimentalWarning -r tsx/esm src/main.ts",
|
"debug": "tsx --inspect src/main.ts",
|
||||||
"clean": "rm -rf dist",
|
"clean": "rm -rf dist",
|
||||||
"lint": "eslint src --ext .ts,.tsx",
|
"lint": "eslint src --ext .ts,.tsx",
|
||||||
"typecheck": "tsc --noEmit"
|
"typecheck": "tsc --noEmit"
|
||||||
|
@ -13,9 +13,6 @@ export interface VSCodeMessage {
|
|||||||
callbackId?: string;
|
callbackId?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 适配 ESM 的 __dirname
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = dirname(__filename);
|
|
||||||
|
|
||||||
// 统一路径变量
|
// 统一路径变量
|
||||||
const devHome = join(__dirname, '..', '..');
|
const devHome = join(__dirname, '..', '..');
|
||||||
|
@ -9,9 +9,6 @@ import path from 'path';
|
|||||||
import { setRunningCWD } from './hook/setting.js';
|
import { setRunningCWD } from './hook/setting.js';
|
||||||
import { exit } from 'process';
|
import { exit } from 'process';
|
||||||
|
|
||||||
// 适配 ESM 的 __dirname
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = dirname(__filename);
|
|
||||||
|
|
||||||
export interface VSCodeMessage {
|
export interface VSCodeMessage {
|
||||||
command: string;
|
command: string;
|
||||||
|
@ -2,9 +2,11 @@ import * as assert from 'assert';
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
suite('测试基础插件激活和命令注册', () => {
|
suite('测试基础插件激活和命令注册', () => {
|
||||||
vscode.window.showInformationMessage('Start base tests.');
|
vscode.window.showInformationMessage('开始测试基础插件激活和命令注册');
|
||||||
|
setup(async () => {
|
||||||
test('Sample test', () => {
|
await vscode.commands.executeCommand('workbench.view.extension.openmcp-sidebar');
|
||||||
|
});
|
||||||
|
test('测试的测试', () => {
|
||||||
assert.strictEqual([1, 2, 3].indexOf(5), -1);
|
assert.strictEqual([1, 2, 3].indexOf(5), -1);
|
||||||
assert.strictEqual([1, 2, 3].indexOf(0), -1);
|
assert.strictEqual([1, 2, 3].indexOf(0), -1);
|
||||||
});
|
});
|
||||||
@ -25,9 +27,5 @@ suite('测试基础插件激活和命令注册', () => {
|
|||||||
assert.ok(commands.includes('openmcp.showOpenMCP'), '命令未注册');
|
assert.ok(commands.includes('openmcp.showOpenMCP'), '命令未注册');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('等待 10 秒以便观察窗口', async function () {
|
|
||||||
this.timeout(15000);
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 10000));
|
|
||||||
});
|
|
||||||
//
|
//
|
||||||
});
|
});
|
44
src/test/e2e/suite/connect.test.ts
Normal file
44
src/test/e2e/suite/connect.test.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
import * as vscode from 'vscode';
|
||||||
|
import * as sinon from 'sinon';
|
||||||
|
|
||||||
|
|
||||||
|
suite('连接管理测试', () => {
|
||||||
|
vscode.window.showInformationMessage('开始测试连接管理');
|
||||||
|
|
||||||
|
let inputBoxStub: sinon.SinonStub;
|
||||||
|
let quickPickStub: sinon.SinonStub;
|
||||||
|
|
||||||
|
setup(async () => {
|
||||||
|
// mock showQuickPick
|
||||||
|
// quickPickStub = sinon.stub(vscode.window, 'showQuickPick');
|
||||||
|
// // mock showInputBox
|
||||||
|
// inputBoxStub = sinon.stub(vscode.window, 'showInputBox');
|
||||||
|
await vscode.commands.executeCommand('workbench.view.extension.openmcp-sidebar');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
teardown(() => {
|
||||||
|
sinon.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('新建STDIO连接', async function () {
|
||||||
|
this.timeout(15000);
|
||||||
|
// await vscode.commands.executeCommand('openmcp.sidebar.workspace-connection.addConnection');
|
||||||
|
// quickPickStub.onFirstCall().resolves('STDIO');
|
||||||
|
// await new Promise(resolve => setTimeout(resolve, 5000));
|
||||||
|
// inputBoxStub.onFirstCall().resolves('echo'); // command
|
||||||
|
// await new Promise(resolve => setTimeout(resolve, 5000));
|
||||||
|
// inputBoxStub.onSecondCall().resolves(''); // cwd
|
||||||
|
|
||||||
|
await vscode.commands.executeCommand('openmcp.sidebar.workspace-connection.addConnection');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test('等待以便观察窗口', async function () {
|
||||||
|
this.timeout(15000);
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 10000));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user