nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.17k stars 2.3k forks source link

NX does not set a fixed version of Cypress in package.json after migrating #22482

Closed mirobo closed 4 months ago

mirobo commented 5 months ago

Current Behavior

There is a project with Cypress 13.6.4 and NX 18.0.8. When running npx nx migrate --run-migrations it updates Cypress even though the used version of Cypress does not have an issue:

Ran update-cypress-version-13-6-6 from @nx/cypress
  Update to Cypress ^13.6.6 if the workspace is using Cypress v13 to ensure workspaces don't use v13.6.5 which has an issue when verifying Cypress.

It is only an issue if version 13.6.5 is used.

Then it sets the version in package.json to "cypress": "^13.6.6" which leads to a uncontrolled, newer update of Cypress when running npm i. When running this now, it will update to 13.7.1

Expected Behavior

nx migrate latest --run-migrations should used fixed versions of Cypress as it does with all other packages (like Angular)

GitHub Repo

No response

Steps to Reproduce

  1. Migrate a project that has Cypress 13.6.4 and NX 18.0.8

Nx Report

n/a

Failure Logs

No response

Package Manager Version

10.2.3

Operating System

Additional Information

No response

FrozenPandaz commented 5 months ago

As long as your lockfile is committed the version of Cypress is locked.

We verify that whichever version of Cypress is installed by Nx works as we expect it. Of course, something can slip by our verification.

Is there an issue you are seeing with Cypress 13.7.1?

mirobo commented 5 months ago

No, there no issue (yet 😅) with Cypress 13.7.1. But I don't quite understand why NX allows minor upgrades for Cypress while the Angular dependency is a fixed version. We often switch branches where we have different versions of dependencies in package.json and we need to run "npm ci". IntelliJ always suggests to run "npm install" when the file was changed, which is bad in the case there are dynamic version like this in package.json. That's why we'd like to have a fixed version of Cypress to prevent such issues from even happening in the IDE. Of course the developer is responsible for his work, but If I can prevent an issue from ever happening, I'll take that measure any time and save a lot of potential trouble and work in merge requests.

Our main starting point for upgrades is "npx migrate latest". But I'm not sure if we're doing it right then, since we could just install a newer version of Cypress by running "npm i" when the version is set to ^13.6.6. I don't see what the recommended way of working is, in this regard. As I learned in another ticket, it depends when nx migrate latest is executed. If you do it too early, when you will miss out on the automatic Angular migrations and you need to trigger them manually.

github-actions[bot] commented 5 months ago

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏

mirobo commented 4 months ago

Can this be reopened? I'd greatly appreciate feedback on my last comment, if possible :-)

github-actions[bot] commented 3 months ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.