Skip to content

Commit ebfa44c

Browse files
committed
returning non mutated range
1 parent c3561b9 commit ebfa44c

File tree

1 file changed

+5
-5
lines changed
  • packages/schematics/update/update

1 file changed

+5
-5
lines changed

packages/schematics/update/update/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,24 @@ type PeerVersionTransform = string | ((range: string) => string);
3232
// supports 6.0, by adding that compatibility to the range, so it is `^5.0.0 || ^6.0.0`.
3333
// We export it to allow for testing.
3434
export function angularMajorCompatGuarantee(range: string) {
35-
range = semver.validRange(range);
36-
if (range === null) {
35+
let newRange = semver.validRange(range);
36+
if (!newRange) {
3737
return range;
3838
}
3939
let major = 1;
40-
while (!semver.gtr(major + '.0.0', range)) {
40+
while (!semver.gtr(major + '.0.0', newRange)) {
4141
major++;
4242
if (major >= 99) {
4343
// Use original range if it supports a major this high
4444
// Range is most likely unbounded (e.g., >=5.0.0)
45-
return range;
45+
return newRange;
4646
}
4747
}
4848

4949
// Add the major version as compatible with the angular compatible, with all minors. This is
5050
// already one major above the greatest supported, because we increment `major` before checking.
5151
// We add minors like this because a minor beta is still compatible with a minor non-beta.
52-
let newRange = range;
52+
newRange = range;
5353
for (let minor = 0; minor < 20; minor++) {
5454
newRange += ` || ^${major}.${minor}.0-alpha.0 `;
5555
}

0 commit comments

Comments
 (0)