Skip to content

peerDependencies shouldn't be updated by lerna publish #1018

@ianstormtaylor

Description

@ianstormtaylor

Given the following setup and using independent versioning:

packages
| -- foo
| -- bar
// foo/package.json
{
  "version" "0.2.1"
}
// bar/package.json
{
  "peerDependencies": {
    "foo": ">=0.2.0"
  },
  "devDependencies": {
    "foo": "^0.2.1"
  }
}

If you make changes in foo, and run lerna publish (patch)...

  1. foo will updated to 0.2.2, as expected.
  2. bar's dev dependency on foo will be updated to ^0.2.2, also as expected.
  3. But bar's peer depdenncy on foo will be overwritten to ^0.2.2, unexpectedly!

I think the peerDependencies tracking of Lerna should be disabled, since it's impossible for Lerna to know whether a change would have forced a peer dependency upgrade or not.

Peer dependencies should remain as loose as possible, with the absolute earliest accepted version that works, reducing warning noise and increasing interop. With the current logic of forcing a bump with each publish, Lerna forces dependents to upgrade even if there's no need to.

Related to #955

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions