From db45e5cc716d35eecb34f6413d0b9567c714b3a6 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Tue, 12 Jun 2018 06:47:43 +0200 Subject: [PATCH] refactor: push repositoryUrl down --- .../repository/process/lookup/index.js | 8 +- .../lookup/__snapshots__/index.spec.js.snap | 86 ------------------- 2 files changed, 4 insertions(+), 90 deletions(-) diff --git a/lib/workers/repository/process/lookup/index.js b/lib/workers/repository/process/lookup/index.js index 4137a3dcac..f002ed0e1d 100644 --- a/lib/workers/repository/process/lookup/index.js +++ b/lib/workers/repository/process/lookup/index.js @@ -21,7 +21,7 @@ async function lookupUpdates(config) { matches, getNewValue, } = versioning(config.versionScheme); - const updates = []; + let updates = []; const dependency = await getDependency(config.purl, config); if (!dependency) { // If dependency lookup fails then warn and return @@ -130,15 +130,15 @@ async function lookupUpdates(config) { buckets[bucket] = update; } } + updates = updates.concat(Object.values(buckets)); let { repositoryUrl } = dependency; // istanbul ignore if if (!(repositoryUrl && repositoryUrl.length)) { repositoryUrl = null; } return { - updates: updates - .concat(Object.values(buckets)) - .map(update => ({ ...update, repositoryUrl })), + repositoryUrl, + updates, }; } diff --git a/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap b/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap index bce2c9f576..87e1a28585 100644 --- a/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap +++ b/test/workers/repository/process/lookup/__snapshots__/index.spec.js.snap @@ -6,7 +6,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "0.4.4", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -15,7 +14,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -30,7 +28,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -43,7 +40,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "==0.9.4", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -53,7 +49,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "==0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -64,7 +59,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "==1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -98,7 +92,6 @@ Array [ "newMajor": 2, "newMinor": 9, "newValue": "^2.9.1-insiders.20180516", - "repositoryUrl": "https://github.com/Microsoft/TypeScript", "toVersion": "2.9.1-insiders.20180516", "type": "minor", }, @@ -129,7 +122,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -138,7 +130,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -173,7 +164,6 @@ Array [ "newMajor": 3, "newMinor": 8, "newValue": "^3.0.0", - "repositoryUrl": "https://github.com/webpack/webpack", "toVersion": "3.8.1", "type": "major", }, @@ -189,7 +179,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "~1.4.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -204,7 +193,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -217,7 +205,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "0.4.4", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -226,7 +213,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -236,7 +222,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -251,7 +236,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -261,7 +245,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -276,7 +259,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -286,7 +268,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -301,7 +282,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -314,7 +294,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "0.4.4", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -323,7 +302,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -336,7 +314,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "0.4.4", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -345,7 +322,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -360,7 +336,6 @@ Array [ "newMajor": 0, "newMinor": 8, "newValue": "0.8.12", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.8.12", "type": "patch", }, @@ -370,7 +345,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -380,7 +354,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -395,7 +368,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "patch", }, @@ -405,7 +377,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -420,7 +391,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "patch", }, @@ -430,7 +400,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -445,7 +414,6 @@ Array [ "isRollback": true, "newMajor": 0, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "semanticCommitType": "fix", "type": "rollback", }, @@ -455,7 +423,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -484,7 +451,6 @@ Array [ "newMajor": 2, "newMinor": 5, "newValue": "2.5.17-beta.0", - "repositoryUrl": "https://github.com/vuejs/vue", "toVersion": "2.5.17-beta.0", "type": "minor", }, @@ -499,7 +465,6 @@ Array [ "newMajor": 2, "newMinor": 5, "newValue": "2.5.17-beta.0", - "repositoryUrl": "https://github.com/vuejs/vue", "toVersion": "2.5.17-beta.0", "type": "minor", }, @@ -527,7 +492,6 @@ Array [ "newMajor": 0, "newMinor": 0, "newValue": "^0.0.35", - "repositoryUrl": "https://github.com/DefinitelyTyped/DefinitelyTyped", "toVersion": "0.0.35", "type": "minor", }, @@ -542,7 +506,6 @@ Array [ "newMajor": 2, "newMinor": 0, "newValue": "2.0.3", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "2.0.3", "type": "major", }, @@ -558,7 +521,6 @@ Array [ "newMajor": 3, "newMinor": 8, "newValue": "1.x - 3.x", - "repositoryUrl": "https://github.com/webpack/webpack", "toVersion": "3.8.1", "type": "major", }, @@ -574,7 +536,6 @@ Array [ "newMajor": 3, "newMinor": 8, "newValue": "^1.0.0 || ^2.0.0 || ^3.0.0", - "repositoryUrl": "https://github.com/webpack/webpack", "toVersion": "3.8.1", "type": "major", }, @@ -589,7 +550,6 @@ Object { "newMajor": 0, "newMinor": 9, "newValue": "^0.7.0 || ^0.8.0 || ^0.9.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", } @@ -604,7 +564,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "~1.2.0 || ~1.3.0 || ~1.4.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -620,7 +579,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "^1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -636,7 +594,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": ">=1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -652,7 +609,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "~1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -665,7 +621,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "0.4.4", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -674,7 +629,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -684,7 +638,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -697,7 +650,6 @@ Array [ "isPin": true, "newMajor": 0, "newValue": "0.4.4", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -706,7 +658,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -716,7 +667,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -732,7 +682,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.2.x - 1.4.x", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -748,7 +697,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.x", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -761,7 +709,6 @@ Array [ "isPin": true, "newMajor": 1, "newValue": "1.3.0", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -770,7 +717,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -786,7 +732,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.x", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -802,7 +747,6 @@ Array [ "newMajor": 2, "newMinor": 0, "newValue": "<= 2", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "2.0.3", "type": "major", }, @@ -818,7 +762,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "<= 1.4", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -834,7 +777,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "<= 0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -845,7 +787,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "<= 1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -861,7 +802,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "< 2", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -877,7 +817,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "< 0.9.8", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -888,7 +827,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "< 1.4.2", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -904,7 +842,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": ">= 0.5.0 < 2.0.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -920,7 +857,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "<= 1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -936,7 +872,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "< 2.0.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -952,7 +887,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": ">= 0.5.0 <= 0.9.7", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -963,7 +897,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": ">= 0.5.0 <= 1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -979,7 +912,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": ">= 0.5.0 <0.10", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -990,7 +922,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": ">= 0.5.0 <1.5", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -1003,7 +934,6 @@ Array [ "isPin": true, "newMajor": 1, "newValue": "1.0.1", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -1012,7 +942,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -1028,7 +957,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "^0.9.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -1039,7 +967,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "^1.0.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -1055,7 +982,6 @@ Array [ "newMajor": 0, "newMinor": 9, "newValue": "~0.9.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "0.9.7", "type": "minor", }, @@ -1066,7 +992,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "~1.4.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -1082,7 +1007,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "major", }, @@ -1098,7 +1022,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -1111,7 +1034,6 @@ Array [ "isPin": true, "newMajor": 1, "newValue": "1.3.0", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -1120,7 +1042,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -1136,7 +1057,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "~1.4.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -1149,7 +1069,6 @@ Array [ "isPin": true, "newMajor": 1, "newValue": "1.0.0", - "repositoryUrl": "https://github.com/kriskowal/q", "type": "pin", }, Object { @@ -1158,7 +1077,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "1.4.1", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -1174,7 +1092,6 @@ Array [ "newMajor": 3, "newMinor": 8, "newValue": "1.x || 2.x || 3.x", - "repositoryUrl": "https://github.com/webpack/webpack", "toVersion": "3.8.1", "type": "major", }, @@ -1190,7 +1107,6 @@ Array [ "newMajor": 3, "newMinor": 8, "newValue": "^2.0.0 || ^3.0.0", - "repositoryUrl": "https://github.com/webpack/webpack", "toVersion": "3.8.1", "type": "major", }, @@ -1206,7 +1122,6 @@ Array [ "newMajor": 1, "newMinor": 4, "newValue": "~1.3.0 || ~1.4.0", - "repositoryUrl": "https://github.com/kriskowal/q", "toVersion": "1.4.1", "type": "minor", }, @@ -1222,7 +1137,6 @@ Array [ "newMajor": 3, "newMinor": 8, "newValue": "1 || 2 || 3", - "repositoryUrl": "https://github.com/webpack/webpack", "toVersion": "3.8.1", "type": "major", }, -- GitLab