Skip to content

Commit

Permalink
refactor: pass versioning to getUpdateType
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Feb 18, 2021
1 parent 1d4672c commit 436abf5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/workers/repository/process/lookup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ export async function lookupUpdates(
update.newMajor = versioning.getMajor(newVersion);
update.newMinor = versioning.getMinor(newVersion);
update.updateType =
update.updateType || getUpdateType(config, currentVersion, newVersion);
update.updateType ||
getUpdateType(config, versioning, currentVersion, newVersion);
update.isSingleVersion =
update.isSingleVersion || !!versioning.isSingleVersion(update.newValue);
if (!versioning.isVersion(update.newValue)) {
Expand Down
7 changes: 3 additions & 4 deletions lib/workers/repository/process/lookup/update-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { LookupUpdateConfig } from './common';

export function getUpdateType(
config: LookupUpdateConfig,
versioning: allVersioning.VersioningApi,
currentVersion: string,
newVersion: string
): UpdateType {
const { versioning } = config;
const version = allVersioning.get(versioning);
if (version.getMajor(newVersion) > version.getMajor(currentVersion)) {
if (versioning.getMajor(newVersion) > versioning.getMajor(currentVersion)) {
return 'major';
}
if (version.getMinor(newVersion) > version.getMinor(currentVersion)) {
if (versioning.getMinor(newVersion) > versioning.getMinor(currentVersion)) {
return 'minor';
}
if (config.separateMinorPatch) {
Expand Down

0 comments on commit 436abf5

Please sign in to comment.