Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build/serve): correct check against angular v2.3.1 #3785

Merged
merged 1 commit into from
Dec 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/angular-cli/upgrade/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export class Version {
isKnown() { return this._version !== null; }

isLocal() { return this.isKnown() && path.isAbsolute(this._version); }
isGreaterThanOrEqualTo(other: SemVer) {
return this._semver.compare(other) >= 0;
}

get major() { return this._semver ? this._semver.major : 0; }
get minor() { return this._semver ? this._semver.minor : 0; }
Expand Down Expand Up @@ -105,7 +108,7 @@ export class Version {
if (v.isLocal()) {
console.warn(yellow('Using a local version of angular. Proceeding with care...'));
} else {
if (v.major != 2 || ((v.minor == 3 && v.patch == 0) || v.minor < 3)) {
if (!v.isGreaterThanOrEqualTo(new SemVer('2.3.1'))) {
console.error(bold(red(stripIndents`
This version of CLI is only compatible with angular version 2.3.1 or better. Please
upgrade your angular version, e.g. by running:
Expand All @@ -129,7 +132,7 @@ export class Version {
It seems like you're using a project generated using an old version of the Angular CLI.
The latest CLI now uses webpack and has a lot of improvements including a simpler
workflow, a faster build, and smaller bundles.

To get more info, including a step-by-step guide to upgrade the CLI, follow this link:
https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.14
` + '\n')));
Expand Down