mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-10 14:06:30 +00:00
parent
bcc65e6e6c
commit
cf870a862e
5 changed files with 30 additions and 5 deletions
|
@ -23,8 +23,11 @@
|
|||
"url": "https://github.com/singapore/renovate/issues"
|
||||
},
|
||||
"homepage": "https://github.com/singapore/renovate#readme",
|
||||
"engines" : { "node" : ">=6.9.0" },
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"changelog": "1.0.7",
|
||||
"gh-got": "5.0.0",
|
||||
"got": "6.7.1",
|
||||
"lodash": "4.17.4",
|
||||
|
|
|
@ -4,7 +4,9 @@ module.exports = {
|
|||
branchName: params => `renovate/${params.depName}-${params.newVersionMajor}.x`,
|
||||
commitMessage: params => `Update dependency ${params.depName} to version ${params.newVersion}`,
|
||||
prBody: params => `This Pull Request updates dependency ${params.depName}` +
|
||||
` from version ${params.currentVersion} to ${params.newVersion}.`,
|
||||
` from version ${params.currentVersion} to ${params.newVersion}.
|
||||
|
||||
${params.changelog}`,
|
||||
prTitleMajor: params => `Update dependency ${params.depName} to version ${params.newVersionMajor}.x`,
|
||||
prTitleMinor: params => `Update dependency ${params.depName} to version ${params.newVersion}`,
|
||||
prTitlePin: params => `Pin dependency ${params.depName} to version ${params.newVersion}`,
|
||||
|
|
|
@ -39,6 +39,7 @@ function getAllDependencyUpgrades(packageContents) {
|
|||
upgradeType: upgrade.type,
|
||||
newVersion: upgrade.version,
|
||||
newVersionMajor: semver.major(upgrade.version),
|
||||
workingVersion: upgrade.workingVersion,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
@ -89,6 +90,7 @@ function getDependencyUpgrades(depName, currentVersion) {
|
|||
allUpgrades[thisMajor] = {
|
||||
type: thisMajor > currentMajor ? 'major' : 'minor',
|
||||
version,
|
||||
workingVersion,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ function setNewValue(currentFileContent, depType, depName, newVersion) {
|
|||
logger.debug(`Found match at index ${searchIndex}`);
|
||||
// Now test if the result matches
|
||||
const testContent = replaceAt(currentFileContent, searchIndex, searchString, newString);
|
||||
logger.debug(`testContent = ${testContent}`);
|
||||
// Compare the parsed JSON structure of old and new
|
||||
if (_.isEqual(parsedContents, JSON.parse(testContent))) {
|
||||
newFileContent = testContent;
|
||||
|
|
23
src/index.js
23
src/index.js
|
@ -1,3 +1,4 @@
|
|||
const changelog = require('changelog');
|
||||
const github = require('./helpers/github');
|
||||
const npm = require('./helpers/npm');
|
||||
const packageJson = require('./helpers/packageJson');
|
||||
|
@ -45,7 +46,25 @@ function processUpgradesSequentially(upgrades) {
|
|||
// 1. Reduce chances of GitHub API rate limiting
|
||||
// 2. Edge case collision of branch name, e.g. dependency also listed as dev dependency
|
||||
return upgrades.reduce(
|
||||
(promise, upgrade) => promise.then(() => updateDependency(upgrade)), Promise.resolve());
|
||||
(promise, upgrade) => promise
|
||||
.then(() => getChangelog(upgrade))
|
||||
.then(updateDependency), Promise.resolve());
|
||||
}
|
||||
|
||||
function getChangelog(upgrade) {
|
||||
const semverString = `>${upgrade.workingVersion} <=${upgrade.newVersion}`;
|
||||
let log = '';
|
||||
logger.debug(`semverString: ${semverString}`);
|
||||
return changelog.generate(upgrade.depName, semverString)
|
||||
.then(changelog.markdown)
|
||||
.then((res) => {
|
||||
log = res;
|
||||
return logger.silly(`${upgrade.depName} ${upgrade.newVersion} changelog: ${res}`);
|
||||
})
|
||||
.catch((error) => {
|
||||
logger.verbose(`getChangelog error: ${error}`);
|
||||
})
|
||||
.then(() => Object.assign(upgrade, { changelog: log }));
|
||||
}
|
||||
|
||||
function updateDependency(upgrade) {
|
||||
|
@ -147,7 +166,7 @@ function updateDependency(upgrade) {
|
|||
return createPr();
|
||||
}
|
||||
// Check if existing PR needs updating
|
||||
if (existingPr.title === prTitle || existingPr.body === prBody) {
|
||||
if (existingPr.title === prTitle && existingPr.body === prBody) {
|
||||
logger.verbose(`${depName}: PR #${existingPr.number} already up-to-date`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue