Updating to the latest version of Nx involves these steps.
nx migrate latest or to a specific version with
nx migrate @nrwl/workspace@version
This fetches the specified version of the
@nrwl/workspace package, analyzes the dependencies and fetches all the dependent packages. This will also update the
package.json and create a
migrations.json file if there are pending migrations.
At this point, no packages have been installed, and no other files have been touched. Now, you can inspect
package.json to see if the changes make sense. Sometimes the migration can update a package to a version that is either not allowed or conflicts with another package. Feel free to manually apply the desired adjustments.
nx migrate --run-migrations
Each Nx plugin is able to provide a set of migrations which are relevant to particular versions of the package, and so
migrations.json (generated in step 1) will only contain migrations which are appropriate for the update you are currently applying. This command will update your source code, but leaves committing the changes up to you unless you add
After you run all the migrations, you can remove
migrations.json and commit any outstanding changes.