UNPKG

@oebot/core

Version:

能跑就行的 QQ 机器人框架,基于 oicq v2,改自KiviBot(R.I.P.)

21 lines (20 loc) 713 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.install = void 0; const node_child_process_1 = require("node:child_process"); const node_util_1 = require("node:util"); const core_1 = require("../core"); // 安装或卸载 node 依赖 async function install(pkg, isUninstall = false) { const promiseExec = (0, node_util_1.promisify)(node_child_process_1.exec); const cmd = `npm ${isUninstall ? 'uninstall' : 'install'} ${pkg ?? ''}`; const { stderr } = await promiseExec(cmd); if (stderr) { if (/npm ERR/i.test(stderr)) { core_1.OELogger.error(stderr); return false; } } return true; } exports.install = install;