How to Upgrade Angular 2 To Angular 4

This how-to page describe step by step for upgrading existing Angular 2 application to Angular 4.

Step-by-step guide

  1. Install the latest version of Angular CLI
  2. Make sure you get the correct version of Angular CLI
  3. Go to your git repository then fork your project (if you are using gitlab and your project belongs to a group then you will unable to create a fork into the same group, don’t worry it’s normal)
  4. Clone forked repository
  5. Backup your package.json and .angular-cli.json
  6. Generate new project with Angular CLI and use the same name as the original project
  7. Answer the interactive installation screen, overwrite only files that not part of your primary code
  8. Compare package.json against package.json.bak then manually install every third party library required
  9. Compare .angular-cli.json against .angular-cli.json.bak then include all assets required
  10. Run the application then fix any error found (big grin)
  11. Commit and push the forked repository
  12. Open pull request, put forked repository as Source Branch and original repository as Target Branch
  13. Close/Accept pull request
  14. Go to original project directory and pull from the “upgrade” branch
  15. Delete node_modules directory
  16. Install new package dependencies

Leave a Reply

Your email address will not be published. Required fields are marked *