Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): run migrations ordered by their target version #21799

Merged

Conversation

leosvelperez
Copy link
Member

@leosvelperez leosvelperez commented Feb 13, 2024

Current Behavior

Most of the time, all migrations of a given plugin are run ordered by their target version. This can be problematic sometimes when a migration of a plugin checks stuff from another plugin.

Such an issue occurred and is explained in #20407 (comment):

  • the update-tsconfig-spec-jest migration from the @nx/angular package targets the version 15.9.0-beta.3
  • that migration checks targets with the @nrwl/jest:jest executor to perform an update to the tsconfig.spec.json
  • the update-16-0-0-add-nx-packages migration from the @nx/jest package targets the version 16.0.0-beta.1
  • that migration renames and replaces all occurrences of @nrwl/jest with @nx/jest
  • the @nx/jest package migrations run before the @nx/angular package migrations

Note how @nrwl/jest:jest will be replaced @nx/jest:jest before running the update-tsconfig-spec-jest migration from the @nx/angular package, even though that migration was written/released and targets a lower version of Nx. That migration shouldn't know about the @nx/* scoped packages because it was written for a version where the rescoping hadn't occurred yet.

Expected Behavior

Migrations should be run ordered by their target version regardless of the plugin they are for.

Note: the 15-7-0-split-configuration-into-project-json-files migration from @nx/workspace is a special case that's meant to run first.

Related Issue(s)

Fixes #

@leosvelperez leosvelperez self-assigned this Feb 13, 2024
Copy link

vercel bot commented Feb 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Feb 13, 2024 11:28am

@leosvelperez leosvelperez marked this pull request as ready for review February 13, 2024 11:44
@leosvelperez leosvelperez requested a review from a team as a code owner February 13, 2024 11:44
@leosvelperez leosvelperez merged commit 81f59ef into nrwl:master Feb 13, 2024
6 checks passed
@leosvelperez leosvelperez deleted the core/run-migrations-ordered-by-version branch February 13, 2024 15:50
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants