Skip to content

changeset publish does not replace workspace: ranges with current version in workspace before publishing with yarn as a package manager #432

@abdes

Description

@abdes

Affected Packages

@changesets/cli

yarn version: 2.1.1
changeset cli version: 2.9.2

Problem

@zkochan has already raised an issue with support of workspace ranges in dependencies, and he already proposed a solution for his immediate need of bumping workspace:x.y.z dependencies when changeset version is invoked.

However, this only bumps the semver range in the package.json but keeps the workspace: int it. That is the expected behavior locally but is not the expected behavior during publish.

  • workspace: with a semver range should have the 'workspace:' stripped before the publish.
  • workspace:* should have the '*' resolved to the workspace version and the the 'workspace:' stripped before the publish.

changeset publish does not do that resulting in the NPM package being published with 'workspace:' in the version specified which obviously does not work.

Proposed solution

Not sure, but @zkochan already had a comment regarding this at: https://github.com/atlassian/changesets/pull/311/files#r407058482 and to my knowledge yarn2 properly publishes such packages when invoked with 'yarn npm publish'. Not sure about pnpm.
Maybe the solution is to let the package manager handle this?

Workaround so far:
I am using yarn v2, so the workaround for me is ugly but produces consistent results.

  • Just stop at changeset version
  • Use yarn npm publish to publish packages
  • manually create git tags
  • push to git

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