From 409cd4addec3278d428e810fbb2c0553d53c765c Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Tue, 15 May 2018 07:21:10 +0200
Subject: [PATCH] refactor: monorepoPackages -> internalPackages

---
 lib/manager/npm/extract/monorepo.js           | 14 +++++------
 lib/workers/repository/process/fetch.js       |  4 ++--
 .../__snapshots__/monorepo.spec.js.snap       | 24 +++++++++----------
 test/manager/npm/extract/monorepo.spec.js     |  4 ++--
 .../process/__snapshots__/fetch.spec.js.snap  |  2 +-
 test/workers/repository/process/fetch.spec.js |  2 +-
 6 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/lib/manager/npm/extract/monorepo.js b/lib/manager/npm/extract/monorepo.js
index 1219de5839..2e3f27cf5a 100644
--- a/lib/manager/npm/extract/monorepo.js
+++ b/lib/manager/npm/extract/monorepo.js
@@ -29,19 +29,19 @@ function detectMonorepos(packageFiles) {
         { packageFile },
         'Found monorepo packages with base path ' + basePath
       );
-      const subPackagePatterns = packages.map(pattern =>
+      const internalPackagePatterns = packages.map(pattern =>
         upath.join(basePath, pattern)
       );
-      const subPackages = packageFiles.filter(sp =>
-        matchesAnyPattern(path.dirname(sp.packageFile), subPackagePatterns)
+      const internalPackageFiles = packageFiles.filter(sp =>
+        matchesAnyPattern(path.dirname(sp.packageFile), internalPackagePatterns)
       );
-      const subPackageNames = subPackages
+      const internalPackages = internalPackageFiles
         .map(sp => sp.packageJsonName)
         .filter(Boolean);
       // add all names to main package.json
-      packageFile.monorepoPackages = subPackageNames;
-      for (const subPackage of subPackages) {
-        subPackage.monorepoPackages = subPackageNames.filter(
+      packageFile.internalPackages = internalPackages;
+      for (const subPackage of internalPackageFiles) {
+        subPackage.internalPackages = internalPackages.filter(
           name => name !== subPackage.packageJsonName
         );
         subPackage.lernaDir = lernaDir;
diff --git a/lib/workers/repository/process/fetch.js b/lib/workers/repository/process/fetch.js
index 834f127b2f..879b7f6492 100644
--- a/lib/workers/repository/process/fetch.js
+++ b/lib/workers/repository/process/fetch.js
@@ -20,8 +20,8 @@ async function fetchDepUpdates(packageFileConfig, dep) {
     logger.debug({ depName: dep.depName }, 'Dependency is ignored');
     dep.skipReason = 'ignored';
   } else if (
-    depConfig.monorepoPackages &&
-    depConfig.monorepoPackages.includes(depName)
+    depConfig.internalPackages &&
+    depConfig.internalPackages.includes(depName)
   ) {
     logger.debug(
       { depName: dep.depName },
diff --git a/test/manager/npm/extract/__snapshots__/monorepo.spec.js.snap b/test/manager/npm/extract/__snapshots__/monorepo.spec.js.snap
index df1c4fda7c..7e3c3ba158 100644
--- a/test/manager/npm/extract/__snapshots__/monorepo.spec.js.snap
+++ b/test/manager/npm/extract/__snapshots__/monorepo.spec.js.snap
@@ -10,22 +10,22 @@ Array [
     "packageFile": "package.json",
   },
   Object {
-    "lernaClient": undefined,
-    "lernaDir": ".",
-    "monorepoPackages": Array [
+    "internalPackages": Array [
       "@org/b",
     ],
+    "lernaClient": undefined,
+    "lernaDir": ".",
     "npmLock": undefined,
     "packageFile": "packages/a/package.json",
     "packageJsonName": "@org/a",
     "yarnLock": undefined,
   },
   Object {
-    "lernaClient": undefined,
-    "lernaDir": ".",
-    "monorepoPackages": Array [
+    "internalPackages": Array [
       "@org/a",
     ],
+    "lernaClient": undefined,
+    "lernaDir": ".",
     "npmLock": undefined,
     "packageFile": "packages/b/package.json",
     "packageJsonName": "@org/b",
@@ -48,22 +48,22 @@ Array [
     ],
   },
   Object {
-    "lernaClient": "yarn",
-    "lernaDir": ".",
-    "monorepoPackages": Array [
+    "internalPackages": Array [
       "@org/b",
     ],
+    "lernaClient": "yarn",
+    "lernaDir": ".",
     "npmLock": undefined,
     "packageFile": "packages/a/package.json",
     "packageJsonName": "@org/a",
     "yarnLock": undefined,
   },
   Object {
-    "lernaClient": "yarn",
-    "lernaDir": ".",
-    "monorepoPackages": Array [
+    "internalPackages": Array [
       "@org/a",
     ],
+    "lernaClient": "yarn",
+    "lernaDir": ".",
     "npmLock": undefined,
     "packageFile": "packages/b/package.json",
     "packageJsonName": "@org/b",
diff --git a/test/manager/npm/extract/monorepo.spec.js b/test/manager/npm/extract/monorepo.spec.js
index b4be349bad..4341a13aee 100644
--- a/test/manager/npm/extract/monorepo.spec.js
+++ b/test/manager/npm/extract/monorepo.spec.js
@@ -23,7 +23,7 @@ describe('manager/npm/extract', () => {
       await detectMonorepos(packageFiles);
       expect(packageFiles).toMatchSnapshot();
       expect(packageFiles[1].lernaDir).toEqual('.');
-      expect(packageFiles[1].monorepoPackages).toEqual(['@org/b']);
+      expect(packageFiles[1].internalPackages).toEqual(['@org/b']);
     });
     it('uses yarn workspaces package settings', async () => {
       const packageFiles = [
@@ -46,7 +46,7 @@ describe('manager/npm/extract', () => {
       await detectMonorepos(packageFiles);
       expect(packageFiles).toMatchSnapshot();
       expect(packageFiles[1].lernaDir).toEqual('.');
-      expect(packageFiles[1].monorepoPackages).toEqual(['@org/b']);
+      expect(packageFiles[1].internalPackages).toEqual(['@org/b']);
     });
   });
 });
diff --git a/test/workers/repository/process/__snapshots__/fetch.spec.js.snap b/test/workers/repository/process/__snapshots__/fetch.spec.js.snap
index 5a267eaa22..7c5ffe806a 100644
--- a/test/workers/repository/process/__snapshots__/fetch.spec.js.snap
+++ b/test/workers/repository/process/__snapshots__/fetch.spec.js.snap
@@ -61,7 +61,7 @@ Object {
           "updates": Array [],
         },
       ],
-      "monorepoPackages": Array [
+      "internalPackages": Array [
         "zzzz",
       ],
       "packageFile": "package.json",
diff --git a/test/workers/repository/process/fetch.spec.js b/test/workers/repository/process/fetch.spec.js
index fed32a4432..47b29ac5f6 100644
--- a/test/workers/repository/process/fetch.spec.js
+++ b/test/workers/repository/process/fetch.spec.js
@@ -35,7 +35,7 @@ describe('workers/repository/process/fetch', () => {
               { depName: 'zzzz' },
               { depName: 'foo' },
             ],
-            monorepoPackages: ['zzzz'],
+            internalPackages: ['zzzz'],
           },
         ],
       };
-- 
GitLab