Skip to content

Commit

Permalink
refactor: fixedVersion calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Feb 18, 2021
1 parent 5af13b1 commit f41430b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/workers/repository/process/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,11 @@ export async function lookupUpdates(
config.versioning || getDefaultVersioning(datasource)
);
const res: UpdateResult = { updates: [], warnings: [] } as any;

// Record if the dep is fixed to a version
if (lockedVersion) {
res.fixedVersion = lockedVersion;
} else if (currentValue && versioning.isSingleVersion(currentValue)) {
res.fixedVersion = currentValue.replace(/^=+/, '');
}
// istanbul ignore if
if (!isGetPkgReleasesConfig(config)) {
res.skipReason = SkipReason.InvalidConfig;
return res;
}

const isValid = currentValue && versioning.isValid(currentValue);
if (isValid) {
const dependency = clone(await getPkgReleases(config));
Expand Down Expand Up @@ -298,6 +290,13 @@ export async function lookupUpdates(
delete res.skipReason;
}
}

// Record if the dep is fixed to a version
if (lockedVersion) {
res.fixedVersion = lockedVersion;
} else if (currentValue && versioning.isSingleVersion(currentValue)) {
res.fixedVersion = currentValue.replace(/^=+/, '');
}
// Add digests if necessary
if (supportsDigests(config)) {
if (currentDigest && datasource !== datasourceGitSubmodules.id) {
Expand Down

0 comments on commit f41430b

Please sign in to comment.