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

[command:version] Version number in related peerDependencies don't update #2402

Open
BioPhoton opened this issue Jan 2, 2020 · 7 comments
Open

Comments

@BioPhoton
Copy link

When run lerna version also respect dependencies in peerDependencies.

Current Behavior

When execution lerna version the peerDependencies don't update, but the devDependencies do.
Here a result after the bumping version of packageA and packageB from 0.0.0 to 0.0.1

packageA

{
  "name": "packageA",
  "version": "0.0.1",
}

packageB

{
  "name": "packageB",
  "version": "0.0.1",
  "peerDependencies": {
    "@scope/packageA": "0.0.0"
  },
  "devDependencies": {
    "@scope/packageA": "0.0.1"
  }
}

Expected Behavior

packageA

{
  "name": "packageA",
  "version": "0.0.1",
}

packageB

{
  "name": "packageB",
  "version": "0.0.1",
  "peerDependencies": {
    "@scope/packageA": "0.0.1"
  },
  "devDependencies": {
    "@scope/packageA": "0.0.1"
  }
}
@ValeryVS
Copy link

ValeryVS commented Jul 22, 2020

It isn't always the right way.

May be packageB really can work with packageA@^15.5.1 while recent packageA is 15.7.0 and developer don't want to enforce users to update.
Or, it can even depend on ^1 | ^2 | ^3. Such peerDependencies is quite common.

@arsnl
Copy link

arsnl commented Jan 13, 2021

@ValeryVS true. Peer dependencies don't act the same as dev nor prod dependencies. However, in some case the peerDependencies should follow the current version. Maybe we should add a new option to the version command to cover this need? Something like --update-peer-dependencies.

@ghiscoding
Copy link

ghiscoding commented Oct 5, 2022

hey guys, I'm looking at implementing this (it's implemented) as an option in Lerna-Lite, it will be opt-in (disabled by default) and it will be very restrictive (it will only work with regular versions). I got an open PR here, feel free to provide feedback on it. I expect to release it within a week or so (done)

It will update (bump) regular semver like these

  • 1.2.3
  • ^1.2.3
  • ~1.2.3
  • ^1.4.0-alpha.0
  • workspace:^1.2.3

but it won't update things like

  • >=1.0.0
  • >=1.0.0 <2.0.0
  • ^1 | ^2 | ^3

@RS-Sautter
Copy link

@JamesHenry can we add this feature also to lerna? If necessary I could help with that.

@runspired
Copy link

An OSS project I work on with many packages in a mono-repo with peer-deps on each other moved to strictly declaring peerDependencies recently now that most package managers properly support and respect them. Unfortunately, this results in peerDependencies being incorrect. We can manually fix the versions during our release process; however, it makes lerna's version command not all that useful since the commit and tag would not include this change.

@andrii-bodnar
Copy link

Experiencing the same issue in the Lingui project. This project contains a couple of packages and some of them have peer dependencies to others. As a result, the lerna version command doesn't update these dependencies

@RS-Sautter
Copy link

ping, any news? Would a MR be accepted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants