Skip to content

Commit

Permalink
refactor(types): optional newValue (#24953)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Oct 2, 2023
1 parent 8a0956d commit 1b70c42
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/modules/manager/types.ts
Expand Up @@ -84,7 +84,7 @@ export interface LookupUpdate {
newMajor?: number;
newMinor?: number;
newName?: string;
newValue: string;
newValue?: string;
semanticCommitType?: string;
pendingChecks?: boolean;
pendingVersions?: string[];
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/process/lookup/generate.ts
Expand Up @@ -66,7 +66,7 @@ export async function generateUpdate(
update.newValue = currentValue;
}
} else {
update.newValue = currentValue!;
update.newValue = currentValue;
}
update.newMajor = versioning.getMajor(newVersion)!;
update.newMinor = versioning.getMinor(newVersion)!;
Expand Down
9 changes: 4 additions & 5 deletions lib/workers/repository/process/lookup/index.ts
Expand Up @@ -381,10 +381,9 @@ export async function lookupUpdates(
}
res.isSingleVersion = true;
}
res.isSingleVersion =
!!res.isSingleVersion ||
!!versioning.isSingleVersion(update.newValue);

res.isSingleVersion ??=
is.string(update.newValue) &&
versioning.isSingleVersion(update.newValue);
res.updates.push(update);
}
} else if (compareValue) {
Expand Down Expand Up @@ -455,7 +454,7 @@ export async function lookupUpdates(
) {
for (const update of res.updates) {
logger.debug({ update });
if (is.string(config.currentValue)) {
if (is.string(config.currentValue) && is.string(update.newValue)) {
update.newValue = config.currentValue.replace(
compareValue,
update.newValue
Expand Down

0 comments on commit 1b70c42

Please sign in to comment.