question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to prevent Lerna from automatically updating dependencies versions?

See original GitHub issue

For example, say that I have 2 packages configured like this:

/packages/foo/package.json

{
  "name": "foo",
  "version": "1.0.0"
}

/packages/bar/package.json

{
  "name": "bar",
  "version": "1.0.0",
  "dependencies": {
    "foo": "1.0.0"
  }
}

I then make a breaking change to foo and on my next lerna publish three things will happen:

  • foo version will be bumped to v2.0.0
  • foo dependency in bar will also be bumped to v2.0.0
  • bar version will be bumped to v1.0.1 (due to previous point)

Is there any way to prevent the automatic bump of the foo dependency in bar? And, consequentially, prevent the bar version bump to v1.0.1 (nothing changed after all).

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:17
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

49reactions
hendrikvolschenkcommented, Feb 22, 2021

package.json already indicates what it allows to install up to:

  • >1.0.0 - Bump everything, including major.
  • ~1.0.0 - Bump only patch versions.
  • ^1.0.0 - Bump patch and minor versions.
  • 1.0.0 - Don’t touch anything

If lerna could respect these when bumping other packages (while keeping/transferring the prefix) then it would work for many of us with the same needs as @rfgamaral and allow for even more control in other situations.

27reactions
BrianLoughnanecommented, Mar 16, 2021

+1 on this issue. Would love if sibling dep version ranges were respected (ie overwritten by a new range only if the new version matches the existing range). Seems that the current behavior is redundant to the “file:path/to/package” specifier but allows no such specification of sibling dep version ranges.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent Lerna from automatically updating dependencies ...
How to prevent Lerna from automatically updating dependencies versions ? ... Open Closed Paid Out. Refresh Issue ... Overview; Backers (0); Updates ...
Read more >
Does Lerna bump dependency versions when releasing new ...
Yes, if you run lerna version major _all packages in your repo will be updated to a new major version and the package.json...
Read more >
lerna-update-wizard - npm Package Health Analysis - Snyk
Command line interface for simplifying the process of bulk updating dependencies across multiple Lerna or Yarn Workspace packages.
Read more >
Lerna reborn — What's new in v6?. Lerna v6 is out ... - Nx Blog
As a result, with v6 all Lerna workspaces have the useNx set to true by default even if you don't have it in...
Read more >
Configuration Options - Renovate Docs
Its purpose is if you want Renovate to update the version field within your package file any time it updates dependencies within. Usually...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found