@hypermod/cli
Version:
To download and run codemods, we provide a CLI tool called @hypermod/cli.
29 lines (28 loc) • 1.08 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeConfigs = void 0;
function mergeConfigs(config1, config2) {
const config = { transforms: {}, presets: {} };
if (config1) {
config.transforms = Object.keys(config1.config.transforms || []).reduce((accum, key) => {
accum[key] = `${config1.filePath}@${key}`;
return accum;
}, {});
config.presets = Object.keys(config1.config.presets || []).reduce((accum, key) => {
accum[key] = `${config1.filePath}#${key}`;
return accum;
}, {});
}
if (config2) {
config.transforms = Object.keys(config2.config.transforms || []).reduce((accum, key) => {
accum[key] = `${config2.filePath}@${key}`;
return accum;
}, {});
config.presets = Object.keys(config2.config.presets || []).reduce((accum, key) => {
accum[key] = `${config2.filePath}#${key}`;
return accum;
}, {});
}
return config;
}
exports.mergeConfigs = mergeConfigs;
;