Skip to content

Dependency declared in multiple dependency arrays (e.g. in both peerDeps and devDeps) with different version range is not updated correctly #411

Closed

Description

@Feiyang1

Affected Packages

@changesets/cli

Problem

Dependency declared in multiple dependency arrays (e.g. in both peerDeps and devDeps) with different version range is not updated correctly.

Suppose I have 2 packages
pkg-a

{
    name: "pkg-a",
    version: "1.0.0"
    peerDependencies: {
        pkg-b: "^1.0.0"
    },
    devDependencies: {
        pkg-b: "1.0.0"
    }
}

pkg-b

{
    name: "pkg-b",
    version: "1.0.0"
}

Suppose there is a changeset that updates pkg-b to 1.0.1. The 2 packages will end up with the following state:

pkg-a

{
    name: "pkg-a",
    version: "1.0.0"
    peerDependencies: {
        pkg-b: "^1.0.0"
    },
    devDependencies: {
        pkg-b: "1.0.0" // ISSUE: it should be bumped to 1.0.1
    }
}

pkg-b

{
    name: "pkg-b",
    version: "1.0.1"
}

ISSUE: pkg-b in pkg-a's devDependencies is not bumped.

The issue is that changeset assumes the same dependency share the same version range across dependencies, devDependencies, peerDependencies, etc. In this case, changesets only uses the peerDependency to decide whether or not to create a release object for pkg-a. It didn't create one because pkg-b: "^1.0.0" satisfies 1.0.1.

Proposed solution

Do not assume the same dependency in different dependency arrays shares the same version range.
Code change to: https://github.com/atlassian/changesets/blob/master/packages/assemble-release-plan/src/determine-dependents.ts#L174

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions