mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 15:06:27 +00:00
fix(terraform): handle greater than with full version (#9632)
This commit is contained in:
parent
8b8d7767bc
commit
df2f451e37
2 changed files with 32 additions and 4 deletions
|
@ -67,6 +67,30 @@ describe('semver.getNewValue()', () => {
|
||||||
newVersion: '2.0.7',
|
newVersion: '2.0.7',
|
||||||
})
|
})
|
||||||
).toEqual('~> 2.0.0');
|
).toEqual('~> 2.0.0');
|
||||||
|
expect(
|
||||||
|
semver.getNewValue({
|
||||||
|
currentValue: '~> 0.14.0',
|
||||||
|
rangeStrategy: 'replace',
|
||||||
|
currentVersion: '0.14.1',
|
||||||
|
newVersion: '0.15.0',
|
||||||
|
})
|
||||||
|
).toEqual('~> 0.15.0');
|
||||||
|
expect(
|
||||||
|
semver.getNewValue({
|
||||||
|
currentValue: '~> 0.14.0',
|
||||||
|
rangeStrategy: 'replace',
|
||||||
|
currentVersion: '0.14.1',
|
||||||
|
newVersion: '0.15.1',
|
||||||
|
})
|
||||||
|
).toEqual('~> 0.15.0');
|
||||||
|
expect(
|
||||||
|
semver.getNewValue({
|
||||||
|
currentValue: '~> 0.14.6',
|
||||||
|
rangeStrategy: 'replace',
|
||||||
|
currentVersion: '0.14.6',
|
||||||
|
newVersion: '0.15.0',
|
||||||
|
})
|
||||||
|
).toEqual('~> 0.15.0');
|
||||||
});
|
});
|
||||||
it('handles comma dividers', () => {
|
it('handles comma dividers', () => {
|
||||||
expect(
|
expect(
|
||||||
|
|
|
@ -36,10 +36,14 @@ function getNewValue({
|
||||||
newVersion,
|
newVersion,
|
||||||
}: NewValueConfig): string {
|
}: NewValueConfig): string {
|
||||||
if (/~>\s*0\.\d+/.test(currentValue) && npm.getMajor(newVersion) === 0) {
|
if (/~>\s*0\.\d+/.test(currentValue) && npm.getMajor(newVersion) === 0) {
|
||||||
return currentValue.replace(
|
const testFullVersion = /(~>\s*0\.)(\d+)\.\d$/;
|
||||||
/(~>\s*0\.).*$/,
|
let replaceValue = '';
|
||||||
`$1${npm.getMinor(newVersion)}`
|
if (testFullVersion.test(currentValue)) {
|
||||||
);
|
replaceValue = `$1${npm.getMinor(newVersion)}.0`;
|
||||||
|
} else {
|
||||||
|
replaceValue = `$1${npm.getMinor(newVersion)}$3`;
|
||||||
|
}
|
||||||
|
return currentValue.replace(/(~>\s*0\.)(\d+)(.*)$/, replaceValue);
|
||||||
}
|
}
|
||||||
// handle special ~> 1.2 case
|
// handle special ~> 1.2 case
|
||||||
if (/(~>\s*)\d+\.\d+$/.test(currentValue)) {
|
if (/(~>\s*)\d+\.\d+$/.test(currentValue)) {
|
||||||
|
|
Loading…
Reference in a new issue