From cd9adf76b5cb03bd3ffc752265d6379b13cd7c1f Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Wed, 4 Jul 2018 19:20:34 +0200
Subject: [PATCH] refactor: RENOVATE_REUSE_PACKAGE_LOCK

Attempted workaround for #1984
---
 lib/manager/npm/post-update/index.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/manager/npm/post-update/index.js b/lib/manager/npm/post-update/index.js
index ddf21b6bdb..07ba883b10 100644
--- a/lib/manager/npm/post-update/index.js
+++ b/lib/manager/npm/post-update/index.js
@@ -182,7 +182,10 @@ async function writeExistingFiles(config, packageFiles) {
     const { npmLock } = packageFile;
     if (npmLock) {
       const npmLockPath = upath.join(config.tmpDir.path, npmLock);
-      if (config.updateType === 'lockFileMaintenance') {
+      if (
+        process.env.RENOVATE_REUSE_PACKAGE_LOCK === 'false' ||
+        config.updateType === 'lockFileMaintenance'
+      ) {
         logger.debug(`Ensuring ${npmLock} is removed`);
         await fs.remove(npmLockPath);
       } else {
-- 
GitLab