UNPKG

@zambelz/zhc

Version:
26 lines 1.26 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getProfileConfig = exports.getConfigData = void 0; const node_path_1 = __importDefault(require("node:path")); const node_fs_1 = __importDefault(require("node:fs")); const global_1 = require("./global"); const getConfigData = () => { const config = node_path_1.default.join(global_1.ROOT_PATH, "config.jsonc"); const content = node_fs_1.default.readFileSync(config, "utf-8"); return JSON.parse(content); }; exports.getConfigData = getConfigData; const getProfileConfig = (profile) => { const configData = getConfigData(); const targetProfile = profile || configData?.defaultProfile; const profilePath = node_path_1.default.join(global_1.PROFILES_PATH, targetProfile); const profileConfigPath = node_path_1.default.join(profilePath, "config.jsonc"); const profileConfigContent = node_fs_1.default.readFileSync(profileConfigPath, "utf-8"); const profileConfig = JSON.parse(profileConfigContent); return profileConfig; }; exports.getProfileConfig = getProfileConfig; //# sourceMappingURL=config.js.map