X Tutup
Skip to content

changeset version should return a non-zero error code if there are no changesets #1815

@mcintyre94

Description

@mcintyre94

In a repo with changesets configured but no changesets:

$ npx changeset version --snapshot canary
🦋  warn No unreleased changesets found, exiting.
$ echo $?
0

This makes it difficult to publish canary builds using changesets. For example the following CI job:

$ pnpm changeset version --snapshot canary
$ pnpm publish --tag canary

The expected behaviour is that we version our packages with a -canary-<something> suffix, and then publish packages with version x.y.z.canary-<something> to NPM

But in the case that there are no changesets, this will print the warning about no changesets, and then silently continue to publish our packages as x.y.z with the tag canary. This then causes issues if another CI job is intended to publish x.y.z with the tag latest, as that version is already published on npm.

I think the best solution would be for changeset version to return a non-zero exit code when there are no changesets.

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

      X Tutup