Skip to content

Make peerDependencies release type match dependant package or configurable #827

Closed

Description

@tkanzakic

Affected Packages

pkg:@changesets/assemble-release-plan

Problem

We have this mono repo https://github.com/cmpsr/composer when some packages have peerDependencies to other internal packages, for instance @cmpsr/blocks depends on @cmpsr/components and @cmpsr/nextjs-contentful-renderer depends on both @cmpsr/components and @cmpsr/blocks. We have configured the repo so that we update the packages with peerDependencies after each update of the dependency. The issue we have is that right now the changesets generates a major release for packages with peerDependencies -even when the changelog reflects a patch- and we do not want to do a major just because a dependencies has been patched. An example pull request in here where a minor release of @cmpsr/components produce a major release of both blocks and nextjs-contentful-renderer packages.

What have we tried

As a workaround we added this to our .changesets/config.json:

  "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
    "onlyUpdatePeerDependentsWhenOutOfRange": true,
    "updateInternalDependents": "always"
  }

With this config when we update a package the packages with peerDependencies to it are producing a patch release but the changelog for the release is empty:

# @cmpsr/blocks

## 2.0.1
                          <----- Missing changelog in here
## 2.0.0

See the full diff in here

Proposed solution

Ideal scenario

Do the same type of release for the package with peerDependencies as the dependency release type. I.e.:

  • if we do a patch release for @cmpsr/components then do a patch release for @cmpsr/blocks and @cmpsr/nextjs-contentful-renderer
  • if we do a patch release for @cmpsr/components and a minor release for @cmpsr/blocks then do a minor release for @cmpsr/nextjs-contentful-renderer
  • if we do a major release for @cmpsr/components then do a major for all dependant packages

Good first approach

Make the release type for peerDependencies configurable via config.json file, something like:

  "updatePeerDependentsAs": "patch" | "minor" | "major"

Activity

  1. changed the title [-]Make peerDependencies release type configurable[/-] [+]Make peerDependencies release type match dependant package or configurable[/+] on Jun 2, 2022
  2. Andarist commented on Aug 16, 2022

    @Andarist
    Member

    Could you propose this in the actual+expected format? It's hard for me to deduce all of the required information about your packages, your config etc from just the description. I'd like to ensure that we are exactly on the same page to discuss such changes.

  3. giancarlosisasi commented on Nov 15, 2022

    @giancarlosisasi

    +1 🙏🏼
    We just migrated from Lerna to changeset and now we have noticed that our libraries are now in version 10+ when we have only done minor and patch releases in the peerDependencies 😢 . Would be good to have the option updatePeerDependentsAs 🙏🏼

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