UNPKG

sda

Version:

Software development assistant

41 lines 1.73 kB
"use strict"; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const path = __importStar(require("path")); const getAbsolutePath_1 = __importDefault(require("../utils/getAbsolutePath")); /** * Replaces all relative paths in a config file with absolute paths. * This includes environment paths and file paths directories. */ function replaceConfigWithAbsolutePaths(config, configFilePath) { const dir = path.parse(configFilePath).dir; if (config.environments) { for (const key of Object.keys(config.environments)) { const env = config.environments[key]; env.path = getAbsolutePath_1.default(env.path, dir); } } if (config.templates) { Object.keys(config.templates).forEach((templateId) => { const template = config.templates[templateId]; Object.keys(template.commands).forEach((commandId) => { const command = template.commands[commandId]; if (command.filePath) { command.filePath = getAbsolutePath_1.default(command.filePath, dir); } }); }); } return config; } exports.default = replaceConfigWithAbsolutePaths; //# sourceMappingURL=replaceConfigWithAbsolutePaths.js.map