Skip to content
Snippets Groups Projects
Commit 28ffae2e authored by Rhys Arkins's avatar Rhys Arkins
Browse files

Improve comments

parent 41f20487
No related branches found
No related tags found
No related merge requests found
......@@ -39,14 +39,19 @@ function validateArguments() {
}
function initializeGitHub() {
if (config.verbose) {
console.log('Initializing GitHub');
}
return github.init(token, repoName, config.baseBranch, config.verbose);
}
function getPackageFileContents() {
console.log('Getting package file contents');
return github.getFileContents(packageFile);
}
function determineUpgrades(packageFileContents) {
console.log('Determining required upgrades');
return npm.getAllDependencyUpgrades(packageFileContents);
}
......@@ -77,6 +82,7 @@ function updateDependency(depType, depName, currentVersion, nextVersion) {
const commitMessage = config.templates.commitMessage({ depName, currentVersion, nextVersion });
// Check if same PR already existed and skip if so
// This allows users to close an unwanted upgrade PR and not worry about seeing it raised again
return github.checkForClosedPr(branchName, prTitle).then((prExisted) => {
if (prExisted) {
console.log(`${depName}: Skipping due to existing PR found.`);
......
......@@ -41,7 +41,9 @@ module.exports = {
allDependencyChecks.push(getDependencyUpgrades(depName, currentVersion)
.then(res => {
if (Object.keys(res).length > 0) {
console.log(`${depName} upgrades: ${JSON.stringify(res)}`);
if (config.verbose) {
console.log(`${depName}: Upgrades = ${JSON.stringify(res)}`);
}
Object.keys(res).forEach(function(majorVersion) {
allDependencyUpgrades.push({
depType: depType,
......@@ -50,7 +52,10 @@ module.exports = {
nextVersion: res[majorVersion],
});
});
} else {
if (config.verbose) {
console.log(`${depName}: No upgrades required`);
}
}
}));
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment