Skip to content
Snippets Groups Projects
Unverified Commit 0f872f8b authored by Sergei Zharinov's avatar Sergei Zharinov Committed by GitHub
Browse files

fix(npm): Types for `bumpVersion` parameter (#23717)

parent ae9b3afa
No related branches found
No related tags found
No related merge requests found
...@@ -3,10 +3,18 @@ import { logger } from '../../../../../logger'; ...@@ -3,10 +3,18 @@ import { logger } from '../../../../../logger';
import { regEx } from '../../../../../util/regex'; import { regEx } from '../../../../../util/regex';
import type { BumpPackageVersionResult } from '../../../types'; import type { BumpPackageVersionResult } from '../../../types';
type MirrorBumpVersion = `mirror:${string}`;
function isMirrorBumpVersion(
bumpVersion: string
): bumpVersion is MirrorBumpVersion {
return bumpVersion.startsWith('mirror:');
}
export function bumpPackageVersion( export function bumpPackageVersion(
content: string, content: string,
currentValue: string, currentValue: string,
bumpVersion: ReleaseType bumpVersion: ReleaseType | `mirror:${string}`
): BumpPackageVersionResult { ): BumpPackageVersionResult {
logger.debug( logger.debug(
{ bumpVersion, currentValue }, { bumpVersion, currentValue },
...@@ -16,7 +24,7 @@ export function bumpPackageVersion( ...@@ -16,7 +24,7 @@ export function bumpPackageVersion(
let newPjVersion: string | null; let newPjVersion: string | null;
let bumpedContent = content; let bumpedContent = content;
try { try {
if (bumpVersion.startsWith('mirror:')) { if (isMirrorBumpVersion(bumpVersion)) {
const mirrorPackage = bumpVersion.replace('mirror:', ''); const mirrorPackage = bumpVersion.replace('mirror:', '');
const parsedContent = JSON.parse(content); const parsedContent = JSON.parse(content);
newPjVersion = newPjVersion =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment