UNPKG

@herbertgao/surgio

Version:

Generating rules for Surge, Clash, Quantumult like a PRO

38 lines 1.5 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateDoctorInfo = void 0; const path_1 = require("path"); const util_1 = require("util"); const check_node_version_1 = __importDefault(require("check-node-version")); const fs_extra_1 = require("fs-extra"); const generateDoctorInfo = async (cwd, pjson) => { const doctorInfo = []; const checkInfo = await (0, util_1.promisify)(check_node_version_1.default)().catch(() => null); try { const gatewayPkg = await (0, fs_extra_1.readJSON)((0, path_1.join)(cwd, 'node_modules/@surgio/gateway/package.json')); doctorInfo.push(`@surgio/gateway: ${gatewayPkg.version}`); } catch (_) { // no catch } doctorInfo.push(`surgio: ${pjson.version} (${(0, path_1.join)(__dirname, '../..')})`); if (checkInfo) { Object.keys(checkInfo.versions).forEach((key) => { const version = checkInfo.versions[key].version; if (version) { if (key === 'node') { doctorInfo.push(`${key}: ${version} (${process.execPath})`); } else { doctorInfo.push(`${key}: ${version}`); } } }); } return doctorInfo; }; exports.generateDoctorInfo = generateDoctorInfo; //# sourceMappingURL=doctor.js.map