renovate/lib/manager/meteor/update.js
Rhys Arkins d8cb261ecb
refactor: rename version -> value (#2076)
Renames currentVersion to currentValue, newVersion to newValue, newVersionMajor to newMajor, and newVersionMinor to newMinor.
2018-06-04 05:48:20 +02:00

16 lines
447 B
JavaScript

module.exports = {
updateDependency,
};
function updateDependency(fileContent, upgrade) {
const { depName, currentValue, newValue } = upgrade;
logger.debug(`meteor.updateDependency(): ${depName} = ${newValue}`);
const regexReplace = new RegExp(
`('|")(${depName})('|"):(\\s+)('|")${currentValue}('|")`
);
const newFileContent = fileContent.replace(
regexReplace,
`$1$2$3:$4$5${newValue}$6`
);
return newFileContent;
}