From 52b2de3bdbdc6e06b88f1420f2925bac116304fc Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@keylocation.sg> Date: Tue, 22 Aug 2017 10:46:27 +0200 Subject: [PATCH] fix: equalize carriage returns before comparing lock files (#717) Eliminating one more possibility for #707 --- lib/workers/branch/npm.js | 5 ++++- lib/workers/branch/yarn.js | 3 ++- package.json | 1 + yarn.lock | 4 ++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/workers/branch/npm.js b/lib/workers/branch/npm.js index 9de0b9b52e..0a6b23d924 100644 --- a/lib/workers/branch/npm.js +++ b/lib/workers/branch/npm.js @@ -1,3 +1,4 @@ +const eol = require('eol'); const fs = require('fs-extra'); const cp = require('child_process'); const path = require('path'); @@ -118,7 +119,9 @@ async function maintainLockFile(inputConfig) { logger ); logger.trace(`newPackageLock:\n${newPackageLock.contents}`); - if (existingPackageLock.toString() === newPackageLock.contents.toString()) { + if ( + eol.lf(existingPackageLock) === eol.lf(newPackageLock.contents.toString()) + ) { logger.debug('npm lock file does not need updating'); return null; } diff --git a/lib/workers/branch/yarn.js b/lib/workers/branch/yarn.js index 02405837c1..a1f998ebd9 100644 --- a/lib/workers/branch/yarn.js +++ b/lib/workers/branch/yarn.js @@ -1,3 +1,4 @@ +const eol = require('eol'); const fs = require('fs-extra'); const cp = require('child_process'); const path = require('path'); @@ -121,7 +122,7 @@ async function maintainLockFile(inputConfig) { logger ); logger.trace(`newYarnLock:\n${newYarnLock.contents}`); - if (existingYarnLock.toString() === newYarnLock.contents.toString()) { + if (eol.lf(existingYarnLock) === eol.lf(newYarnLock.contents.toString())) { logger.debug('Yarn lock file does not need updating'); return null; } diff --git a/package.json b/package.json index 344abdf5ad..526cc09710 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "changelog": "1.4.0", "commander": "2.11.0", "conventional-commits-detector": "0.1.1", + "eol": "0.9.0", "fs-extra": "4.0.1", "gh-got": "6.0.0", "github-url-from-git": "1.5.0", diff --git a/yarn.lock b/yarn.lock index 6b7336f657..c7381ddcce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1147,6 +1147,10 @@ ecdsa-sig-formatter@1.0.9: base64url "^2.0.0" safe-buffer "^5.0.1" +eol@0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/eol/-/eol-0.9.0.tgz#5c33e25b7001bbb69ca6947593d3332e36e04f6a" + errno@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.4.tgz#b896e23a9e5e8ba33871fc996abd3635fc9a1c7d" -- GitLab