Skip to content

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

Open

Description

@BioPhoton

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"
  }
}

Activity

  1. ValeryVS commented on Jul 22, 2020

    @ValeryVS

    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.

  2. arsnl commented on Jan 13, 2021

    @arsnl

    @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.

  3. ghiscoding commented on Oct 5, 2022

    @ghiscoding

    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
  4. RS-Sautter commented on Nov 3, 2022

    @RS-Sautter

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

  5. runspired commented on Nov 8, 2022

    @runspired

    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.

  6. andrii-bodnar commented on May 4, 2023

    @andrii-bodnar

    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

  7. RS-Sautter commented on Jul 5, 2023

    @RS-Sautter

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions