Note: This article was published on 10/06/2024.

This is a seres of articles about Angular Installation, Upgrading.

A - Introduction

This article is to discuss a upgrading process for an Angular app in a nx environment.

The content of this article:

B - Way to Update an Angular App

We follow the work from article Update Angular from 12 to 17 (1) --- Initial Point and start to update the Angular app.

For an Angular app upgrding, we have discussed in my previous article, Update Angular For Environment And Project. Starting from Angular 6, the process of upgrading or updating the Angular apps to the latest version has become very easy. You can follow this Angular Update Guide step by step, such as

The above gave the detailed steps needed to update Angular to the version 7 from version 2.4.

C - Start to Update an Angular

What we need to do is

  1. Get the current Angular version;
  2. According to the Angular version, check on Angular Update Guide to get the updating schedule.

Let us get the Project Angular version first. The environment is used to be like this

and for the app to run, we downgraded the node to v16:

We need to run ng -v within the project to get the project Angular version. However, we got difficulty like this:

To fix it, we upgraded Node.js to version 18.9.0, however, the Angular version within the project is still the same as what the environment is: --- Version 18.2.4

instead of as shown in package.json file, the version should be 12.

On the other hand, if we remove Angular globally,

the App is still running well.

We realize that the Angular App is not driven by Angular environment, but by nx.

D - What is UX

Search on Google for angular vs. nx, AI tells us:

Nx and Angular CLI are both tools used in Angular projects, but they're best suited for different project needs and scales:

Here are some other differences between Nx and Angular CLI:

E - How to Update a Nx-Angular App

Search on Google for how to update a nx-angular project, AI tells us:

AI Overview

Learn more…Opens in new tab

To update an NX-Angular project, you can use the following commands:

  1. npx nx migrate latest (or certain version): Updates dependencies in package.json and generates a migrations.json file
  2. npm install: Installs the new dependencies
  3. npx nx migrate --run-migrations: Executes the migration scripts based on migrations.json

Nx migrations can streamline the process of updating an Angular and Nx workspace. However, they may not always cover every aspect, so you can refer to other projects for guidance. You can also create a new workspace with the latest version, compare the changes, and incorporate them into your existing workspace.

Here are some other things to consider when updating an NX-Angular project:

F - Update a Nx-Angular App

We will discuss the details in the next article

References: