Why do migrations with packageJsonUpdates use pinned versions? #33487
Unanswered
jurgensweere
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been maintaining a couple of nx plugins and have been writing migrations for them. Most of the time, only a couple of packages need their versions to be bumped. The packageJsonUpdates field in migrations.json is suitable for that. However, when you use this field, nx always ends up writing a pinned version of the dependency (or devDependency) in the package.json of the consumer.
for instance:
{ "packageJsonUpdates": { ... "1.4.1": { "version": "1.4.1", "packages": { "@webcomponents/scoped-custom-element-registry": { "version": "^0.0.9" } } } }nx will figure out that there is a 0.0.10 version available and installs that version. So far so good. However, the package.json will end up having
instead of:
The problem that might arise here is that you can end up having two versions of this dependency in the future when another package still references to it with a caret.
As an alternative, I have to write an actual migration and use the
addDependenciesToPackageJsonfunction. Using this function maintains the caret or tilde in front of the version.The question here for me is: what is the reasoning to always have these versions pinned after a migration?
Is there an option to not have the version pinned while still using the
packageJsonUpdatesfield?Beta Was this translation helpful? Give feedback.
All reactions