mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-10 22:16:28 +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"
|
"url": "https://github.com/singapore/renovate/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/singapore/renovate#readme",
|
"homepage": "https://github.com/singapore/renovate#readme",
|
||||||
"engines" : { "node" : ">=6.9.0" },
|
"engines": {
|
||||||
|
"node": ">=6.9.0"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"changelog": "1.0.7",
|
||||||
"gh-got": "5.0.0",
|
"gh-got": "5.0.0",
|
||||||
"got": "6.7.1",
|
"got": "6.7.1",
|
||||||
"lodash": "4.17.4",
|
"lodash": "4.17.4",
|
||||||
|
|
|
@ -4,7 +4,9 @@ module.exports = {
|
||||||
branchName: params => `renovate/${params.depName}-${params.newVersionMajor}.x`,
|
branchName: params => `renovate/${params.depName}-${params.newVersionMajor}.x`,
|
||||||
commitMessage: params => `Update dependency ${params.depName} to version ${params.newVersion}`,
|
commitMessage: params => `Update dependency ${params.depName} to version ${params.newVersion}`,
|
||||||
prBody: params => `This Pull Request updates dependency ${params.depName}` +
|
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`,
|
prTitleMajor: params => `Update dependency ${params.depName} to version ${params.newVersionMajor}.x`,
|
||||||
prTitleMinor: params => `Update dependency ${params.depName} to version ${params.newVersion}`,
|
prTitleMinor: params => `Update dependency ${params.depName} to version ${params.newVersion}`,
|
||||||
prTitlePin: params => `Pin 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,
|
upgradeType: upgrade.type,
|
||||||
newVersion: upgrade.version,
|
newVersion: upgrade.version,
|
||||||
newVersionMajor: semver.major(upgrade.version),
|
newVersionMajor: semver.major(upgrade.version),
|
||||||
|
workingVersion: upgrade.workingVersion,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,6 +90,7 @@ function getDependencyUpgrades(depName, currentVersion) {
|
||||||
allUpgrades[thisMajor] = {
|
allUpgrades[thisMajor] = {
|
||||||
type: thisMajor > currentMajor ? 'major' : 'minor',
|
type: thisMajor > currentMajor ? 'major' : 'minor',
|
||||||
version,
|
version,
|
||||||
|
workingVersion,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ function setNewValue(currentFileContent, depType, depName, newVersion) {
|
||||||
logger.debug(`Found match at index ${searchIndex}`);
|
logger.debug(`Found match at index ${searchIndex}`);
|
||||||
// Now test if the result matches
|
// Now test if the result matches
|
||||||
const testContent = replaceAt(currentFileContent, searchIndex, searchString, newString);
|
const testContent = replaceAt(currentFileContent, searchIndex, searchString, newString);
|
||||||
logger.debug(`testContent = ${testContent}`);
|
|
||||||
// Compare the parsed JSON structure of old and new
|
// Compare the parsed JSON structure of old and new
|
||||||
if (_.isEqual(parsedContents, JSON.parse(testContent))) {
|
if (_.isEqual(parsedContents, JSON.parse(testContent))) {
|
||||||
newFileContent = 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 github = require('./helpers/github');
|
||||||
const npm = require('./helpers/npm');
|
const npm = require('./helpers/npm');
|
||||||
const packageJson = require('./helpers/packageJson');
|
const packageJson = require('./helpers/packageJson');
|
||||||
|
@ -45,7 +46,25 @@ function processUpgradesSequentially(upgrades) {
|
||||||
// 1. Reduce chances of GitHub API rate limiting
|
// 1. Reduce chances of GitHub API rate limiting
|
||||||
// 2. Edge case collision of branch name, e.g. dependency also listed as dev dependency
|
// 2. Edge case collision of branch name, e.g. dependency also listed as dev dependency
|
||||||
return upgrades.reduce(
|
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) {
|
function updateDependency(upgrade) {
|
||||||
|
@ -147,7 +166,7 @@ function updateDependency(upgrade) {
|
||||||
return createPr();
|
return createPr();
|
||||||
}
|
}
|
||||||
// Check if existing PR needs updating
|
// 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`);
|
logger.verbose(`${depName}: PR #${existingPr.number} already up-to-date`);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue