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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/metal-queens-doubt.md
@@ -0,0 +1,5 @@
---
"@changesets/apply-release-plan": patch
---

Improve error handling when an invalid release type is specified in a changeset
6 changes: 6 additions & 0 deletions packages/apply-release-plan/src/get-changelog-entry.ts
Expand Up @@ -51,6 +51,12 @@ export default async function getChangelogEntry(
changesets.forEach((cs) => {
const rls = cs.releases.find((r) => r.name === release.name);
if (rls && rls.type !== "none") {
if (!(rls.type in changelogLines)) {
throw new Error(
`Invalid release type of "${rls.type}" for package "${rls.name}" in changeset "${cs.id}"`
);
}

changelogLines[rls.type].push(
changelogFuncs.getReleaseLine(cs, rls.type, changelogOpts)
);
Expand Down