Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions lib/modules/versioning/cargo/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,13 @@ describe('modules/versioning/cargo/index', () => {
expect(!!semver.isSingleVersion(version)).toBe(expected);
});

it('returns a pinned value', () => {
expect(semver.getPinnedValue?.('1.2.3')).toBe('=1.2.3');
});

it.each`
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'*'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'1'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'1.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'^1'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'^1.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'^1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'~1'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'~0.7'} | ${'replace'} | ${'0.7.3'} | ${'0.8.5'} | ${'~0.8'}
${'~1.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${'~1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.0'} | ${'=1.0.0'}
${null} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${null}
${'*'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'*'}
${'=1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.1.0'} | ${'=1.1.0'}
Expand Down
15 changes: 8 additions & 7 deletions lib/modules/versioning/cargo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ export const urls = [
'https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html',
];
export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'pin',
'replace',
];
export const supportedRangeStrategies: RangeStrategy[] = ['bump', 'replace'];

const isVersion = (input: string): boolean => npm.isVersion(input);

Expand Down Expand Up @@ -87,20 +83,24 @@ const isSingleVersion = (constraint: string): boolean =>
constraint.trim().startsWith('=') &&
isVersion(constraint.trim().substring(1).trim());

function getPinnedValue(newVersion: string): string {
return `=${newVersion}`;
}

function getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
}: NewValueConfig): string {
if (!currentValue || currentValue === '*') {
return rangeStrategy === 'pin' ? `=${newVersion}` : currentValue;
return currentValue;
}
// If the current value is a simple version, bump to fully specified newVersion
if (rangeStrategy === 'bump' && regEx(/^\d+(?:\.\d+)*$/).test(currentValue)) {
return newVersion;
}
if (rangeStrategy === 'pin' || isSingleVersion(currentValue)) {
if (isSingleVersion(currentValue)) {
let res = '=';
if (currentValue.startsWith('= ')) {
res += ' ';
Expand Down Expand Up @@ -172,6 +172,7 @@ function isBreaking(current: string, version: string): boolean {
export const api: VersioningApi = {
...npm,
getNewValue,
getPinnedValue,
isBreaking,
isLessThanRange,
isSingleVersion,
Expand Down
2 changes: 0 additions & 2 deletions lib/modules/versioning/composer/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ describe('modules/versioning/composer/index', () => {

it.each`
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'~1.0'} | ${'pin'} | ${'1.0'} | ${'V1.1'} | ${'V1.1'}
${'^1.0'} | ${'pin'} | ${'1.0'} | ${'V1.1'} | ${'V1.1'}
${'v1.0'} | ${'replace'} | ${'1.0'} | ${'1.1'} | ${'v1.1'}
${'^1.0'} | ${'bump'} | ${'1.0.0'} | ${'1.0.7'} | ${'^1.0.7'}
${'^9.4'} | ${'bump'} | ${'9.4.3'} | ${'9.4.8'} | ${'^9.4.8'}
Expand Down
4 changes: 0 additions & 4 deletions lib/modules/versioning/composer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'widen',
'pin',
'replace',
'update-lockfile',
];
Expand Down Expand Up @@ -249,9 +248,6 @@ function getNewValue({
currentVersion,
newVersion,
}: NewValueConfig): string | null {
if (rangeStrategy === 'pin') {
return newVersion;
}
if (rangeStrategy === 'update-lockfile') {
if (matches(newVersion, currentValue)) {
return currentValue;
Expand Down
122 changes: 52 additions & 70 deletions lib/modules/versioning/conan/index.spec.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/modules/versioning/conan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ function getNewValue({
newVersion,
}: NewValueConfig): string | null {
const cleanRange = cleanVersion(currentValue);
if (isVersion(currentValue) || rangeStrategy === 'pin') {
if (isVersion(currentValue)) {
return newVersion;
}
const options = getOptions(currentValue);
Expand Down
7 changes: 4 additions & 3 deletions lib/modules/versioning/conda/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,15 @@ describe('modules/versioning/conda/index', () => {
expect(api.isGreaterThan(a, b)).toBe(result);
});

it('returns a pinned value', () => {
expect(api.getPinnedValue?.('1.2.3')).toBe('==1.2.3');
});

it.each`
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'*'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'}
${'*'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'>=1.2.3'}
${'*'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${null}
${'*'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${null}
${'<2.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'}
${'1.0.*'} | ${'pin'} | ${'1.0.0'} | ${'1.2.3'} | ${'==1.2.3'}
${'1.0.*'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.*'}
${'1.2.*'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${'1.2.*'}
${'>=1.0.0'} | ${'bump'} | ${'1.0.0'} | ${'1.2.3'} | ${'>=1.2.3'}
Expand Down
11 changes: 5 additions & 6 deletions lib/modules/versioning/conda/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'widen',
'pin',
'replace',
];

Expand Down Expand Up @@ -64,17 +63,17 @@ function isSingleVersion(input: string): boolean {
return isValidVersion(input.replace(/^==/, '').trimStart());
}

function getPinnedValue(newVersion: string): string {
return '==' + newVersion;
}

function getNewValue({
currentValue,
rangeStrategy,
currentVersion,
newVersion,
isReplacement,
}: NewValueConfig): string | null {
if (rangeStrategy === 'pin') {
return '==' + newVersion;
}

if (currentValue === '*') {
if (rangeStrategy === 'bump') {
return '>=' + newVersion;
Expand Down Expand Up @@ -215,7 +214,7 @@ export const api = {

minSatisfyingVersion,
getNewValue,

getPinnedValue,
matches,
sortVersions,
} satisfies VersioningApi;
9 changes: 0 additions & 9 deletions lib/modules/versioning/debian/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,6 @@ describe('modules/versioning/debian/index', () => {
${'9'} | ${undefined} | ${undefined} | ${'stable'} | ${'12'}
${'oldstable'} | ${undefined} | ${undefined} | ${'12'} | ${'stable'}
${'oldstable'} | ${undefined} | ${undefined} | ${'3'} | ${'3'}
${'oldstable'} | ${'pin'} | ${undefined} | ${'11'} | ${'11'}
${'oldstable'} | ${'pin'} | ${undefined} | ${'stable'} | ${'12'}
${'oldstable'} | ${'pin'} | ${undefined} | ${'bullseye'} | ${'11'}
${'buster'} | ${'pin'} | ${undefined} | ${'11'} | ${'11'}
${'buster'} | ${'pin'} | ${undefined} | ${'stable'} | ${'12'}
${'buster'} | ${'pin'} | ${undefined} | ${'bullseye'} | ${'11'}
${'10'} | ${'pin'} | ${undefined} | ${'11'} | ${'11'}
${'10'} | ${'pin'} | ${undefined} | ${'stable'} | ${'12'}
${'10'} | ${'pin'} | ${undefined} | ${'bullseye'} | ${'11'}
`(
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',
({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => {
Expand Down
28 changes: 2 additions & 26 deletions lib/modules/versioning/debian/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const urls = [
'https://debian.pages.debian.net/distro-info-data/debian.csv',
];
export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = ['pin'];
export const supportedRangeStrategies: RangeStrategy[] = ['replace'];

const RELEASE_PROP = 'release';

Expand Down Expand Up @@ -40,31 +40,7 @@ export class DebianVersioningApi extends GenericVersioningApi {
return this._distroInfo.isReleased(ver) && !this._distroInfo.isEolLts(ver);
}

override getNewValue({
currentValue,
rangeStrategy,
newVersion,
}: NewValueConfig): string {
if (rangeStrategy === 'pin') {
let newVer = newVersion;

// convert newVersion to semVer
if (this._distroInfo.isCodename(newVersion)) {
newVer = this._distroInfo.getVersionByCodename(newVersion);
}
if (this._rollingReleases.has(newVersion)) {
newVer = this._rollingReleases.getVersionByLts(newVersion);
}

// current value is codename or [oldold|old|]stable
if (
this._distroInfo.isCodename(currentValue) ||
this._rollingReleases.has(currentValue)
) {
return newVer;
}
}

override getNewValue({ currentValue, newVersion }: NewValueConfig): string {
// current value is [oldold|old|]stable
if (this._rollingReleases.has(currentValue)) {
return this._rollingReleases.getLtsByVersion(newVersion);
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/versioning/gradle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const urls = [
'https://docs.gradle.org/current/userguide/single_versions.html#version_ordering',
];
export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = ['pin', 'bump'];
export const supportedRangeStrategies: RangeStrategy[] = ['bump'];

const equals = (a: string, b: string): boolean => compare(a, b) === 0;

Expand Down Expand Up @@ -200,7 +200,7 @@ function getNewValue({
rangeStrategy,
newVersion,
}: NewValueConfig): string | null {
if (isVersion(currentValue) || rangeStrategy === 'pin') {
if (isVersion(currentValue)) {
return newVersion;
}

Expand Down
1 change: 0 additions & 1 deletion lib/modules/versioning/hashicorp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'widen',
'pin',
'replace',
];

Expand Down
1 change: 0 additions & 1 deletion lib/modules/versioning/helm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'widen',
'pin',
'replace',
'widen',
];
Expand Down
5 changes: 0 additions & 5 deletions lib/modules/versioning/hex/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,20 @@ describe('modules/versioning/hex/index', () => {

it.each`
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'== 1.2.3'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'== 3.6.1'} | ${'bump'} | ${'3.6.1'} | ${'3.6.2'} | ${'== 3.6.2'}
${'== 3.6.1'} | ${'replace'} | ${'3.6.1'} | ${'3.6.2'} | ${'== 3.6.2'}
${'~> 1.2'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0'}
${'~> 1.2'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 1.2'} | ${'bump'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0'}
${'~> 1.2'} | ${'bump'} | ${'1.2.3'} | ${'1.3.1'} | ${'~> 1.3'}
${'~> 1.1'} | ${'update-lockfile'} | ${'1.2.0'} | ${'1.3.0'} | ${'~> 1.1'}
${'~> 1.1'} | ${'update-lockfile'} | ${'1.2.0'} | ${'2.0.0'} | ${'~> 2.0'}
${'~> 1.2.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0.0'}
${'~> 1.2.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 1.2.0'} | ${'bump'} | ${'1.2.3'} | ${'2.0.7'} | ${'~> 2.0.7'}
${'~> 0.2 and <= 0.2.6'} | ${'widen'} | ${'0.2.6'} | ${'0.2.8'} | ${'~> 0.2 and <= 0.2.8'}
${'>= 1.0.0 and <= 2.0.0'} | ${'widen'} | ${'1.2.3'} | ${'2.0.7'} | ${'>= 1.0.0 and <= 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'<= 2.0.7'}
${'>= 1.0.0 and <= 2.0.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'>= 1.0.0 or <= 2.0.0'} | ${'widen'} | ${'1.2.3'} | ${'2.0.7'} | ${'>= 1.0.0 or <= 2.0.0'}
${'>= 1.0.0 or <= 2.0.0'} | ${'replace'} | ${'1.2.3'} | ${'2.0.7'} | ${'<= 2.0.7'}
${'>= 1.0.0 or <= 2.0.0'} | ${'pin'} | ${'1.2.3'} | ${'2.0.7'} | ${'== 2.0.7'}
${'~> 0.4'} | ${'replace'} | ${'0.4.2'} | ${'0.6.0'} | ${'~> 0.6'}
${'~> 1.0'} | ${'widen'} | ${'1.0.0'} | ${'2.0.0'} | ${'~> 1.0 or ~> 2.0'}
${'~> 1.0.0'} | ${'widen'} | ${'1.0.0'} | ${'2.0.0'} | ${'~> 1.0.0 or ~> 2.0.0'}
Expand Down
1 change: 0 additions & 1 deletion lib/modules/versioning/hex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'widen',
'pin',
'replace',
'update-lockfile',
];
Expand Down
1 change: 1 addition & 0 deletions lib/modules/versioning/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe('modules/versioning/index', () => {
'subset',
'intersects',
'isSame',
'getPinnedValue',
];
const npmApi = Object.keys(allVersioning.get(semverVersioning.id))
.filter((val) => !optionalFunctions.includes(val))
Expand Down
19 changes: 3 additions & 16 deletions lib/modules/versioning/ivy/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,9 @@ describe('modules/versioning/ivy/index', () => {
);

it.each`
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'1'} | ${'auto'} | ${'1'} | ${'1.1'} | ${'1.1'}
${'[1.2.3,]'} | ${'auto'} | ${'1.2.3'} | ${'1.2.4'} | ${'[1.2.3,]'}
${'[1.2.3]'} | ${'pin'} | ${'1.2.3'} | ${'1.2.4'} | ${'1.2.4'}
${'[1.0.0,1.2.3]'} | ${'pin'} | ${'1.0.0'} | ${'1.2.4'} | ${'1.2.4'}
${'[1.0.0,1.2.23]'} | ${'pin'} | ${'1.0.0'} | ${'1.2.23'} | ${'1.2.23'}
${'(,1.0]'} | ${'pin'} | ${'0.0.1'} | ${'2.0'} | ${'2.0'}
${'],1.0]'} | ${'pin'} | ${'0.0.1'} | ${'2.0'} | ${'2.0'}
${'(,1.0)'} | ${'pin'} | ${'0.1'} | ${'2.0'} | ${'2.0'}
${'],1.0['} | ${'pin'} | ${'2.0'} | ${'],2.0['} | ${'],2.0['}
${'[1.0,1.2],[1.3,1.5)'} | ${'pin'} | ${'1.0'} | ${'1.2.4'} | ${'1.2.4'}
${'[1.0,1.2],[1.3,1.5['} | ${'pin'} | ${'1.0'} | ${'1.2.4'} | ${'1.2.4'}
${'[1.2.3,)'} | ${'pin'} | ${'1.2.3'} | ${'1.2.4'} | ${'1.2.4'}
${'[1.2.3,['} | ${'pin'} | ${'1.2.3'} | ${'1.2.4'} | ${'1.2.4'}
${'latest.integration'} | ${'pin'} | ${'1.0'} | ${'2.0'} | ${'2.0'}
${'latest'} | ${'pin'} | ${'1.0'} | ${'2.0'} | ${'2.0'}
currentValue | rangeStrategy | currentVersion | newVersion | expected
${'1'} | ${'auto'} | ${'1'} | ${'1.1'} | ${'1.1'}
${'[1.2.3,]'} | ${'auto'} | ${'1.2.3'} | ${'1.2.4'} | ${'[1.2.3,]'}
`(
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',
({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => {
Expand Down
3 changes: 1 addition & 2 deletions lib/modules/versioning/ivy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'widen',
'pin',
'replace',
];

Expand Down Expand Up @@ -119,7 +118,7 @@ function getNewValue({
rangeStrategy,
newVersion,
}: NewValueConfig): string | null {
if (isVersion(currentValue) || rangeStrategy === 'pin') {
if (isVersion(currentValue)) {
return newVersion;
}
return autoExtendMavenRange(currentValue, newVersion);
Expand Down
1 change: 0 additions & 1 deletion lib/modules/versioning/lambda-node/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ describe('modules/versioning/lambda-node/index', () => {
${'~8.0.0'} | ${'replace'} | ${'8.0.2'} | ${'v8.2.0'} | ${'~8.2.0'}
${'erbium'} | ${'replace'} | ${'12.0.0'} | ${'v14.1.4'} | ${'fermium'}
${'Fermium'} | ${'replace'} | ${'14.0.0'} | ${'v16.1.6'} | ${'gallium'}
${'gallium'} | ${'pin'} | ${'16.1.6'} | ${'v16.1.6'} | ${'16.1.6'}
${'gallium'} | ${'bump'} | ${'16.0.0'} | ${'v16.1.6'} | ${'gallium'}
${'gallium'} | ${'auto'} | ${'16.1.6'} | ${'v16.1.6'} | ${'gallium'}
`(
Expand Down
1 change: 0 additions & 1 deletion lib/modules/versioning/node/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('modules/versioning/node/index', () => {
${'~8.0.0'} | ${'replace'} | ${'8.0.2'} | ${'v8.2.0'} | ${'~8.2.0'}
${'erbium'} | ${'replace'} | ${'12.0.0'} | ${'v14.1.4'} | ${'fermium'}
${'Fermium'} | ${'replace'} | ${'14.0.0'} | ${'v16.1.6'} | ${'gallium'}
${'gallium'} | ${'pin'} | ${'16.1.6'} | ${'v16.1.6'} | ${'16.1.6'}
${'gallium'} | ${'bump'} | ${'16.0.0'} | ${'v16.1.6'} | ${'gallium'}
${'gallium'} | ${'auto'} | ${'16.1.6'} | ${'v16.1.6'} | ${'gallium'}
`(
Expand Down
2 changes: 0 additions & 2 deletions lib/modules/versioning/npm/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ describe('modules/versioning/npm/index', () => {
${'*'} | ${'bump'} | ${'1.0.0'} | ${'1.0.1'} | ${null}
${'*'} | ${'replace'} | ${'1.0.0'} | ${'1.0.1'} | ${null}
${'*'} | ${'widen'} | ${'1.0.0'} | ${'1.0.1'} | ${null}
${'*'} | ${'pin'} | ${'1.0.0'} | ${'1.0.1'} | ${'1.0.1'}
${'*'} | ${'update-lockfile'} | ${'1.0.0'} | ${'1.0.1'} | ${'*'}
${'<=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.3'} | ${'<=1.2.3'}
${'<=1.2.3'} | ${'widen'} | ${'1.0.0'} | ${'1.2.4'} | ${'<=1.2.4'}
Expand Down Expand Up @@ -174,7 +173,6 @@ describe('modules/versioning/npm/index', () => {
${'^1.2.3'} | ${'replace'} | ${'1.2.3'} | ${'1.2.3'} | ${'^1.2.3'}
${'^1.2.3'} | ${'replace'} | ${'1.2.3'} | ${'1.2.2'} | ${'^1.2.2'}
${'^0.9.21'} | ${'replace'} | ${'0.9.21'} | ${'0.9.22'} | ${'^0.9.21'}
${'1.0.0'} | ${'pin'} | ${'1.0.0'} | ${'1.0.1'} | ${'1.0.1'}
${'1.x'} | ${'update-lockfile'} | ${'1.0.0'} | ${'1.0.1'} | ${'1.x'}
${'1.x'} | ${'update-lockfile'} | ${'1.0.0'} | ${'2.0.1'} | ${'2.x'}
${'<2.0.0'} | ${'widen'} | ${'1.0.0'} | ${'2.0.1'} | ${'<3.0.0'}
Expand Down
1 change: 0 additions & 1 deletion lib/modules/versioning/npm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const supportsRanges = true;
export const supportedRangeStrategies: RangeStrategy[] = [
'bump',
'widen',
'pin',
'replace',
];

Expand Down
7 changes: 2 additions & 5 deletions lib/modules/versioning/npm/range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,10 @@ export function getNewValue({
currentVersion,
newVersion,
}: NewValueConfig): string | null {
if (
!['pin', 'update-lockfile'].includes(rangeStrategy) &&
isSemVerXRange(currentValue)
) {
if (rangeStrategy !== 'update-lockfile' && isSemVerXRange(currentValue)) {
return null;
}
if (rangeStrategy === 'pin' || isVersion(currentValue)) {
if (isVersion(currentValue)) {
return newVersion;
}
if (rangeStrategy === 'update-lockfile') {
Expand Down
Loading