mcp-appium-visual
Version:
MCP Server for Appium mobile automation with visual recovery
44 lines • 1.27 kB
JavaScript
/**
* Utility functions for configuration management
*/
import path from 'path';
/**
* Deep merge two objects
*
* @param target The target object to merge into
* @param source The source object to merge from
* @returns A new object with merged properties
*/
export function deepMerge(target, source) {
if (!source) {
return target;
}
const output = { ...target };
for (const key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
if (typeof source[key] === 'object' &&
source[key] !== null &&
!Array.isArray(source[key])) {
output[key] = deepMerge(output[key] || {}, source[key]);
}
else {
output[key] = source[key];
}
}
}
return output;
}
/**
* Convert a relative path to an absolute path
*
* @param relativePath The relative path
* @param basePath Optional base path (defaults to current working directory)
* @returns The absolute path
*/
export function getAbsolutePath(relativePath, basePath) {
if (path.isAbsolute(relativePath)) {
return relativePath;
}
return path.resolve(basePath || process.cwd(), relativePath);
}
//# sourceMappingURL=configUtils.js.map