The Angular framework is continually evolving with new features and optimizations, but to help communities and developers keep organized and their applications up to date, the Angular team uses semantic versioning to number their releases.
A semantic version number is composed of three parts and each part has the following representation:
- Major: A number that is increased every time there is a change in the framework, which in turn requires us to change something in our application so that it continues to work, also known as a breaking change
- Minor: A number that is increased when the new version has a new functionality that we can use, but if we don’t use it, we don’t need to change our application
- Patch: A number that is increased when there is a correction to the framework and we do not need to change our code; this is widely used for versions that have security corrections
In this book, we are working with version 16.2.0 of Angular, and the next version will be 17.0.0, which will bring new functionality and also some breaking changes. While the the term “breaking changes” is used, we should note that the Angular team has taken more and more care with these changes and currently, they only affect very specific cases that the vast majority of applications are not affected by.
In addition to rigorous versioning, the Angular team takes care to release major releases every six months, allowing the team to plan application updates. You may ask, should I always update the Angular version of my application? The answer is yes, and here are some reasons:
- Every new version brings internal improvements to the framework that improve the rendering engines, which can make your application faster and the build time and the bundle size smaller and more optimized
- New features give you more possibilities to create better experiences for your users
- It provides security updates and framework vulnerability fixes
It is important to highlight that the Angular team is committed to making corrections (long-term support) for up to two major versions before the current one, which means that using old versions of Angular can leave your application vulnerable to new security breaches. However, the task of updating the Angular version of an application is not that complex as the Angular CLI helps to automate the entire process. Let’s update our project to version 17 of Angular to use the new features in this chapter.
On your operating system’s command line, in the gym-diary project folder, use the following command:
ng update @angular/core@17 @angular/cli@17
With this command, the Angular CLI will update all Angular packages from the package.json file. Furthermore, it will analyze all your code in search of situations where it needs to be changed due to a breaking change. Also, if possible, it will update your code for you. If this is not possible, it will indicate what type of correction should be made, but again this only happens in very specific corner cases.
After the update is complete, to ensure that the application continues to work after the process, we can run unit tests and end-to-end tests. For more details about the tests, see Chapter 10, Design for Tests: Best Practices.
With our updated project, we can explore the new syntax for HTML templates, which we will see in the next section.
No Responses