nx: migrating from nx 15.8.5 to 17.1.3 has missing migrations

Current Behavior

these commits are missing

  1. update-17-0-0-remove-deprecated-build-options
  2. update-tsconfig-spec-jest
  3. migration-v16-guard-and-resolve-interfaces
  4. update-16-2-0-normalize-tsconfigs

Expected Behavior

these commits to exists

GitHub Repo

No response

Steps to Reproduce

  1. create a new workspace with angular and cypress included in version 15.8.5
  2. migrate to 17.1.3 (latest now)

Nx Report

Node   : 18.16.0
   OS     : win32-x64
   yarn   : 1.22.19

   nx (global)        : 17.1.3
   nx                 : 17.1.3
   @nx/js             : 17.1.3
   @nx/jest           : 17.1.3
   @nx/linter         : 17.1.3
   @nx/eslint         : 17.1.3
   @nx/workspace      : 17.1.3
   @nx/angular        : 17.1.3
   @nx/cypress        : 17.1.3
   @nx/devkit         : 17.1.3
   @nx/eslint-plugin  : 17.1.3
   @nx/plugin         : 17.1.3
   @nrwl/tao          : 17.1.3
   @nx/web            : 17.1.3
   @nx/webpack        : 17.1.3
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @compodoc/compodoc       : 1.1.18
   @ngneat/transloco        : 3.1.4
   @ngrx/component          : 16.0.1
   @ngrx/component-store    : 16.0.1
   @ngrx/effects            : 16.0.1
   @ngrx/entity             : 16.0.1
   @ngrx/router-store       : 16.0.1
   @ngrx/schematics         : 16.0.1
   @ngrx/store              : 16.0.1
   @ngrx/store-devtools     : 16.0.1
   @testing-library/angular : 11.0.2
   ---------------------------------------
   Local workspace plugins:
         workspace-plugin

Failure Logs

NA

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

I want to explain what I was trying to do our aim is to upgrade from angular 15 to 17, but we have some old unmerged branches that have big code changes regarding new features, and most probably we will need to run the migration for them (same happened when we upgraded from angular 13 to 15 regarding angular material legacy change, it made almost all of our unmerged branches broken) when I’m upgrading it’s very difficult to just move from one big version to another because too much changes that you can’t handle and fix, so I moved one minor version at a time (to 15.9, 15.10, 16.0 … till 17.1) and fixing all the errors (which were all fully compatible with angular 15), the problem now that migration.json has only the changes from nx 17.0 to nx 17.1 so I cherry picked these fix commits to a new branch then ran the nx migrate directly from 15.8.5 to latest so we have one migration.json that include everything so after we merge the upgrade the other branch can rebase on it and run the nx migrate --run-migrations to apply these fixes in the old branches as well after I finished I compared the two branches and found there are +100 difference so I started comparing commits (since I’m using nx migrate --run-migrations --create-commits and found these commits missing

  1. update-17-0-0-remove-deprecated-build-options (doesn’t exist in the migration.json)
  2. update-tsconfig-spec-jest (exists in the migration.json, but was skipped for unknown reason)
  3. migration-v16-guard-and-resolve-interfaces (doesn’t exist in the migration.json)
  4. update-16-2-0-normalize-tsconfigs (exists in the migration.json, but was skipped for unknown reason)

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

The main piece of advice is to limit the version jump to, at most, one major at a time. In the case of Angular, this is actually required due to the Angular packages only keeping migrations for a single major version. Regardless, even though we all try our best to provide a solid migration experience, migrating code it’s very difficult. There are so many variations/deviations workspaces can have out there that’s very difficult, if not impossible, to account for every setup and migrate it successfully. We also make mistakes, and it adds up. This risk increases the more versions a migration jumps.

@robertIsaac I confirm the issue with update-17-0-0-remove-deprecated-build-options is also due to migrations not running ordered by the version they target. So, the issue was addressed by the fix I pushed last week.

I’m closing this one since the issues have been addressed and the fix will be released in 18.1.0.

Thanks @leosvelperez for fixing that one I couldn’t find the old branches but fixing that one might fix the others as well

@robertIsaac I fixed the issue with running migrations out of order in https://github.com/nrwl/nx/pull/21799. That fixes the issue you faced with the update-tsconfig-spec-jest migration.

I’m going to close this issue given you mentioned it might be difficult to retrieve the relevant information for the other issues you found. If you later find any relevant information, please create a new issue with the details and link back to this issue. You can tag me and I’ll take a look.