From 35c5fe81a19c537c2619cc64cf695fdae0e2bf7f Mon Sep 17 00:00:00 2001 From: Rhys Arkins Date: Sun, 13 Sep 2020 12:03:20 +0200 Subject: [PATCH] feat(internal): log fixedVersion of dependencies --- .../process/lookup/__snapshots__/index.spec.ts.snap | 9 +++++++++ lib/workers/repository/process/lookup/index.ts | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap index 85638738bc..e464dfa1a6 100644 --- a/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap +++ b/lib/workers/repository/process/lookup/__snapshots__/index.spec.ts.snap @@ -80,6 +80,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() handles digest pin 1 Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "8.0.0", "homepage": undefined, "sourceUrl": "https://github.com/nodejs/node", "updates": Array [ @@ -124,6 +125,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() handles digest pin f Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "8.1.0", "homepage": undefined, "sourceUrl": "https://github.com/nodejs/node", "updates": Array [ @@ -142,6 +144,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() handles digest updat Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "8.0.0", "homepage": undefined, "sourceUrl": "https://github.com/nodejs/node", "updates": Array [ @@ -213,6 +216,7 @@ Object { \`true\` Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.", + "fixedVersion": "1.3.0", "homepage": undefined, "sourceUrl": "https://github.com/kriskowal/q", "updates": Array [ @@ -259,6 +263,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() is deprecated 1`] = Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "1.3.0", "homepage": undefined, "sourceDirectory": "test", "sourceUrl": "https://github.com/kriskowal/q", @@ -425,6 +430,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() returns complex obje Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "1.3.0", "homepage": undefined, "sourceUrl": "https://github.com/kriskowal/q", "updates": Array [ @@ -840,6 +846,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() skips uncompatible v Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "8", "homepage": undefined, "sourceUrl": "https://github.com/nodejs/node", "updates": Array [ @@ -862,6 +869,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() skips uncompatible v Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "8.1", "homepage": undefined, "sourceUrl": "https://github.com/nodejs/node", "updates": Array [ @@ -894,6 +902,7 @@ exports[`workers/repository/process/lookup .lookupUpdates() skips uncompatible v Object { "changelogUrl": undefined, "dependencyUrl": undefined, + "fixedVersion": "8.1.0", "homepage": undefined, "sourceUrl": "https://github.com/nodejs/node", "updates": Array [ diff --git a/lib/workers/repository/process/lookup/index.ts b/lib/workers/repository/process/lookup/index.ts index fcd4b535fd..e08db06d4b 100644 --- a/lib/workers/repository/process/lookup/index.ts +++ b/lib/workers/repository/process/lookup/index.ts @@ -31,7 +31,7 @@ export interface UpdateResult { sourceUrl?: string; skipReason: SkipReason; releases: Release[]; - + fixedVersion?: string; updates: LookupUpdate[]; warnings: ValidationMessage[]; } @@ -142,7 +142,12 @@ export async function lookupUpdates( if (!isValid) { res.skipReason = SkipReason.InvalidValue; } - + // Record if the dep is fixed to a version + if (lockedVersion) { + res.fixedVersion = lockedVersion; + } else if (currentValue && version.isSingleVersion(currentValue)) { + res.fixedVersion = currentValue.replace(/^=+/, ''); + } // istanbul ignore if if (!isGetPkgReleasesConfig(config)) { res.skipReason = SkipReason.Unknown;