how to update an app when ng cli and angular chang

2019-07-10 02:13发布

问题:

How to update an app when ng cli and angular change version like now with ng cli 1.5 and angular 5 ?

My goal is to have an existing project with for instance angular 4 and ng cli 1.4,updated to angular 5 and the one scaffold built by ng cli. (I don't know in this case but also the scaffold have sometime changed so I want the brand new scaffold)

An alternative should be using meld.

I'm looking for a best way/practice because right now I'm following all of these steps.

By now I update if possible the node version with nvm so for instance

  • nvm install v9.0.0

  • nvm use v9.0.0

  • npm install -g @angular/cli

  • ng new myproject

  • overwrite the src and assets folders

  • update package.json

  • copy files like .stylelintrc

  • delete package-lock.json

  • npm install

As you can see a lot of work and also error prone so I'm wondering if there is a smarter way to do the update.

UPDATE

The really problems are the external lib for instance for the OpaqueToken :(

回答1:

UPDATE 23-Oct-2018:

If you are on Angular CLI version 6+ just run ng update then follow the command line instructions. Also checkout this guide Updating your Angular projects


It is not hard at all to update Angular CLI from 1.4 to 1.5. All you need to do is to use angular-cli-diff

  1. choose the cli from and to versions https://github.com/cexbrayat/angular-cli-diff/compare/1.4.0...1.5.0
  2. click on File changed tab
  3. Apply the changes to your current project.
  4. npm install / yarn