From e8eb055b46a3e10772f19c82d5f1362f8e6f1bc2 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sun, 28 Jul 2019 21:34:38 +0200
Subject: [PATCH] fix(npm): remove copyLocalLibs functionality

---
 lib/manager/npm/post-update/index.ts | 59 ----------------------------
 1 file changed, 59 deletions(-)

diff --git a/lib/manager/npm/post-update/index.ts b/lib/manager/npm/post-update/index.ts
index 1c27087a33..20ec653a21 100644
--- a/lib/manager/npm/post-update/index.ts
+++ b/lib/manager/npm/post-update/index.ts
@@ -1,4 +1,3 @@
-import is from '@sindresorhus/is';
 import fs from 'fs-extra';
 import path from 'path';
 import upath from 'upath';
@@ -155,42 +154,6 @@ export async function writeExistingFiles(
       upath.join(basedir, 'package.json'),
       JSON.stringify(massagedFile)
     );
-
-    // copyLocalLibs
-    const toCopy = listLocalLibs(massagedFile.dependencies);
-    toCopy.push(...listLocalLibs(massagedFile.devDependencies));
-    if (toCopy.length !== 0) {
-      logger.debug(`listOfNeededLocalFiles files to copy: ${toCopy}`);
-      await Promise.all(
-        toCopy.map(async localPath => {
-          const resolvedLocalPath = upath.join(
-            path.resolve(basedir, localPath)
-          );
-          if (!resolvedLocalPath.startsWith(upath.join(config.localDir))) {
-            logger.info(
-              `local lib '${toCopy}' will not be copied because it's out of the repo.`
-            );
-          } else {
-            // at the root of local Lib we should find a package.json so that yarn/npm will use it to update *lock file
-            const resolvedRepoPath = upath.join(
-              resolvedLocalPath.substring(config.localDir.length + 1),
-              'package.json'
-            );
-            const fileContent = await platform.getFile(resolvedRepoPath);
-            if (fileContent !== null) {
-              await fs.outputFile(
-                upath.join(resolvedLocalPath, 'package.json'),
-                fileContent
-              );
-            } else {
-              logger.info(
-                `listOfNeededLocalFiles - file '${resolvedRepoPath}' not found.`
-              );
-            }
-          }
-        })
-      );
-    }
     const npmrc = packageFile.npmrc || config.npmrc;
     if (npmrc) {
       await fs.outputFile(upath.join(basedir, '.npmrc'), npmrc);
@@ -272,28 +235,6 @@ export async function writeExistingFiles(
   }
 }
 
-// istanbul ignore next
-function listLocalLibs(
-  dependencies: { [s: string]: unknown } | ArrayLike<unknown>
-) {
-  logger.trace(`listLocalLibs (${dependencies})`);
-  const toCopy = [];
-  if (dependencies) {
-    for (const [libName, libVersion] of Object.entries(dependencies)) {
-      if (is.string(libVersion) && libVersion.startsWith('file:')) {
-        if (libVersion.endsWith('.tgz')) {
-          logger.info(
-            `Link to local lib "${libName}": "${libVersion}" is not supported. Please do it like: 'file:/path/to/folder'`
-          );
-        } else {
-          toCopy.push(libVersion.substring('file:'.length));
-        }
-      }
-    }
-  }
-  return toCopy;
-}
-
 // istanbul ignore next
 export async function writeUpdatedPackageFiles(config: PostUpdateConfig) {
   logger.trace({ config }, 'writeUpdatedPackageFiles');
-- 
GitLab