Skip to content

Commit d0224a5

Browse files
JohannesHoppehansl
authored andcommitted
fix(build/serve): correct check against angular v2.3.1 (angular#3785)
fixes angular#3720, follow up of angular#3729
1 parent 0ce64a4 commit d0224a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/angular-cli/upgrade/version.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ export class Version {
4646
isKnown() { return this._version !== null; }
4747

4848
isLocal() { return this.isKnown() && path.isAbsolute(this._version); }
49+
isGreaterThanOrEqualTo(other: SemVer) {
50+
return this._semver.compare(other) >= 0;
51+
}
4952

5053
get major() { return this._semver ? this._semver.major : 0; }
5154
get minor() { return this._semver ? this._semver.minor : 0; }
@@ -105,7 +108,7 @@ export class Version {
105108
if (v.isLocal()) {
106109
console.warn(yellow('Using a local version of angular. Proceeding with care...'));
107110
} else {
108-
if (v.major != 2 || ((v.minor == 3 && v.patch == 0) || v.minor < 3)) {
111+
if (!v.isGreaterThanOrEqualTo(new SemVer('2.3.1'))) {
109112
console.error(bold(red(stripIndents`
110113
This version of CLI is only compatible with angular version 2.3.1 or better. Please
111114
upgrade your angular version, e.g. by running:
@@ -129,7 +132,7 @@ export class Version {
129132
It seems like you're using a project generated using an old version of the Angular CLI.
130133
The latest CLI now uses webpack and has a lot of improvements including a simpler
131134
workflow, a faster build, and smaller bundles.
132-
135+
133136
To get more info, including a step-by-step guide to upgrade the CLI, follow this link:
134137
https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14
135138
` + '\n')));

0 commit comments

Comments
 (0)