From 7b801f9b6241b13ef2f888485fbc48dc3ccc81cb Mon Sep 17 00:00:00 2001 From: yeyang <746659424@qq.com> Date: Sat, 15 Jun 2024 17:19:04 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20=E7=BB=86=E8=8A=82?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/version.js | 1 - model/State/OtherInfo.js | 13 ++++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/version.js b/apps/version.js index 026fed8..086a289 100644 --- a/apps/version.js +++ b/apps/version.js @@ -1,4 +1,3 @@ -import plugin from "../../../lib/plugins/plugin.js" import { update } from "../../other/update.js" import { Version, Plugin_Name } from "../components/index.js" import { puppeteer } from "../model/index.js" diff --git a/model/State/OtherInfo.js b/model/State/OtherInfo.js index 65c9ea1..37690ce 100644 --- a/model/State/OtherInfo.js +++ b/model/State/OtherInfo.js @@ -7,6 +7,7 @@ import { formatDuration } from "../../tools/index.js" import { osInfo, si } from "./utils.js" let loader = null try { + // eslint-disable-next-line import/no-unresolved loader = (await import("../../../../lib/plugins/loader.js")).default } catch { @@ -48,9 +49,15 @@ function getPluginNum(e) { const plugins = plugin?.length // 获取js插件数量,以.js结尾的文件视为一个插件 const jsDir = path.join(dir, "example") - const js = fs.readdirSync(jsDir) - ?.filter(item => item.endsWith(".js")) - ?.length + let js = 0 + try { + js = fs.readdirSync(jsDir) + ?.filter(item => item.endsWith(".js")) + ?.length + } catch (error) { + logger.debug(error) + } + const pluginsStr = `${plugins ?? 0} plugins | ${js ?? 0} js` if (loader && e.isPro) { const { priority, task } = loader