From 28ffae2e601bf3d1511766222e11913258c0bd0a Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@keylocation.sg>
Date: Sat, 7 Jan 2017 22:58:27 +0100
Subject: [PATCH] Improve comments

---
 src/index.js | 6 ++++++
 src/npm.js   | 9 +++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/index.js b/src/index.js
index e688866424..4656bd55ae 100644
--- a/src/index.js
+++ b/src/index.js
@@ -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.`);
diff --git a/src/npm.js b/src/npm.js
index 10f24c9765..4417cd7c4f 100644
--- a/src/npm.js
+++ b/src/npm.js
@@ -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`);
+            }
           }
         }));
       });
-- 
GitLab