Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling when an invalid release type is specified in a changeset #1260

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

askoufis
Copy link

@askoufis askoufis commented Nov 9, 2023

When specifying a release type, if an invalid type is specified, such as feat, then a relatively unhelpful error is shown to the user:

TypeError: Cannot read properties of undefined (reading 'push')

This occurs because the key feat is not present in this object, so it tries to push to undefined rather than an empty array.

I've added a small check to validate the release type and show an immediately actionable error if the type is invalid:

Invalid release type of "feat" for package "my-package" in changeset "foo-bar-baz"

Happy to work with a maintainer on an alternate solution if this is too naive/doesn't handle some edge cases I'm unaware of.

Copy link

changeset-bot bot commented Nov 9, 2023

🦋 Changeset detected

Latest commit: 57b9b97

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@changesets/apply-release-plan Patch
@changesets/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codesandbox-ci bot commented Nov 9, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 57b9b97:

Sandbox Source
Vanilla Configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant