From 1e73ab5ee67dabbf8869bf4767027e675e4e95aa Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Thu, 13 Jan 2022 18:38:44 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20#80=20=E4=BF=AE=E5=A4=8D=20win=20depd?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +-- src/core/plugin-handler/index.ts | 25 ----------------------- src/renderer/components/result.vue | 16 ++++++++++++++- src/renderer/components/search.vue | 2 +- src/renderer/plugins-manager/options.ts | 27 ++++++++++++++++--------- 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 6ea5896..d13c6a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rubick", - "version": "2.0.1-beta.15", + "version": "2.0.1-beta.16", "private": true, "scripts": { "serve": "vue-cli-service serve", @@ -24,7 +24,6 @@ "fix-path": "^3.0.0", "get-mac-apps": "^1.0.2", "got": "^11.8.3", - "libnpmsearch": "^3.1.2", "lodash.throttle": "^4.1.1", "pouchdb": "^7.2.2", "vue": "^3.0.0", diff --git a/src/core/plugin-handler/index.ts b/src/core/plugin-handler/index.ts index c0db313..2e9c559 100644 --- a/src/core/plugin-handler/index.ts +++ b/src/core/plugin-handler/index.ts @@ -3,7 +3,6 @@ import { AdapterInfo, } from "@/core/plugin-handler/types"; import fs from "fs-extra"; -import search, { Result } from "libnpmsearch"; import path from "path"; import got from "got"; import fixPath from "fix-path"; @@ -90,30 +89,6 @@ class AdapterHandler { await this.execCommand(installCmd, adapters); } - /** - * 从 npm 搜索插件 - * 传入 streamFunc 可以流式处理 - * @param {string} adapter 插件名称 - * @param {(data: Result) => void} [streamFunc] 流式处理钩子 - * @memberof AdapterHandler - */ - async search(adapter: string, streamFunc?: (data: Result) => void) { - return await new Promise((resolve, reject) => { - const result: Result[] = []; - const stream = search.stream(adapter); - stream.on("data", (data: Result) => { - result.push(data); - if (streamFunc !== undefined) streamFunc(data); - }); - stream.on("end", () => { - resolve(result); - }); - stream.on("error", (e: any) => { - reject(e); - }); - }); - } - /** * 更新指定插件 * @param {...string[]} adapters 插件名称 diff --git a/src/renderer/components/result.vue b/src/renderer/components/result.vue index 845c134..b033fc7 100644 --- a/src/renderer/components/result.vue +++ b/src/renderer/components/result.vue @@ -1,6 +1,6 @@