Most of us who have read the release blog for Angular 6 must be quite excited about the ng update
command that was just introduced. But how does it cope with our existing project?
Initially, I was quite surprised that ng update
I could easily upgrade my .NET Core 2.1 RC Angular SPA template without any hitch, except the fact I needed to install the TypeScript version 2.7.2
as one of the pre-requisite. Then the ng update @angular/cli
blew my mind too, as it automatically converts my angular-cli.json
and its content into the new angular.json
with the new structure. Alas, the excitement didn't last long. I decided to give my existing project a try for ng update
. The result? Unsatisfying.
Imagine that you're a kid in the first few queues in the front of a candy shop. Right at 10 AM sharp, the store is open. One by one people entered and brought out a bag of candies that you've been waiting for. Once you're in front of the door, you are not allowed to enter, because you have to be older than your age and have a certain height and weight requirements. That is how it feels when you realise that there are so many restrictions that prevent your ng update
from working. Below is a snippet of my ng update
command.
C:\source\upgrade-sample (master -> origin)
λ ng update
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
@angular/core 5.2.2 -> 6.0.1 ng update @angular/core
rxjs 5.5.2 -> 6.1.0 ng update rxjs
There might be additional packages that are outdated.
Or run ng update --all to try to update all at the same time.
C:\source\upgrade-sample (master -> origin)
λ ng update --all
Package "karma-jasmine-html-reporter" has a missing peer dependency of "jasmine" @ ">=3".
Package "bootstrap" has a missing peer dependency of "jquery" @ "1.9.1 - 3".
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=2.7.2 <2.8", would install "2.8.3").
Package "@ng-idle/core" has an incompatible peer dependency to "@angular/common" (requires "^4.0.0 || ^5.0.0", would install "6.0.1")
Package "@ngrx/router-store" has an incompatible peer dependency to "@angular/common" (requires "^5.0.0", would install "6.0.1")
Package "@ng-idle/keepalive" has an incompatible peer dependency to "@angular/common" (requires "^4.0.0 || ^5.0.0", would install "6.0.1")
Package "@ngrx/store-devtools" has an incompatible peer dependency to "rxjs" (requires "^5.5.0", would install "6.1.0")
Package "@ngrx/store" has an incompatible peer dependency to "@angular/core" (requires "^5.0.0", would install "6.0.1")
Invalid range: ">=6.0.0-rc.0"
Looking at the snippet, I sort of realised that I will end up updating my package manually and one-by-one. Such a tedious task.
Nevertheless, I believe one day ng update
command will be very smart that it will be able to check all package dependencies and update the package.json
smartly.