File tree 1 file changed +7
-4
lines changed
packages/schematics/update/update
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -32,21 +32,24 @@ type PeerVersionTransform = string | ((range: string) => string);
32
32
// supports 6.0, by adding that compatibility to the range, so it is `^5.0.0 || ^6.0.0`.
33
33
// We export it to allow for testing.
34
34
export function angularMajorCompatGuarantee ( range : string ) {
35
- range = semver . validRange ( range ) ;
35
+ let newRange = semver . validRange ( range ) ;
36
+ if ( ! newRange ) {
37
+ return range ;
38
+ }
36
39
let major = 1 ;
37
- while ( ! semver . gtr ( major + '.0.0' , range ) ) {
40
+ while ( ! semver . gtr ( major + '.0.0' , newRange ) ) {
38
41
major ++ ;
39
42
if ( major >= 99 ) {
40
43
// Use original range if it supports a major this high
41
44
// Range is most likely unbounded (e.g., >=5.0.0)
42
- return range ;
45
+ return newRange ;
43
46
}
44
47
}
45
48
46
49
// Add the major version as compatible with the angular compatible, with all minors. This is
47
50
// already one major above the greatest supported, because we increment `major` before checking.
48
51
// We add minors like this because a minor beta is still compatible with a minor non-beta.
49
- let newRange = range ;
52
+ newRange = range ;
50
53
for ( let minor = 0 ; minor < 20 ; minor ++ ) {
51
54
newRange += ` || ^${ major } .${ minor } .0-alpha.0 ` ;
52
55
}
You can’t perform that action at this time.
0 commit comments