Skip to content

Commit

Permalink
Fixed printing how many packages will be published when release plan …
Browse files Browse the repository at this point in the history
…has a release of type none (#30)
  • Loading branch information
Andarist authored May 1, 2021
1 parent 3922260 commit 553f057
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ import { ValidationError } from "@changesets/errors";
const getReleasePlanMessage = (releasePlan: ReleasePlan | null) => {
if (!releasePlan) return "";

let table = markdownTable([
["Name", "Type"],
...releasePlan.releases
const publishableReleases = releasePlan.releases
.filter(
(
x
): x is ComprehensiveRelease & { type: Exclude<VersionType, "none"> } =>
x.type !== "none"
)

let table = markdownTable([
["Name", "Type"],
...publishableReleases
.map((x) => {
return [
x.name,
Expand All @@ -39,15 +41,15 @@ const getReleasePlanMessage = (releasePlan: ReleasePlan | null) => {
return `<details><summary>This PR includes ${
releasePlan.changesets.length
? `changesets to release ${
releasePlan.releases.length === 1
publishableReleases.length === 1
? "1 package"
: `${releasePlan.releases.length} packages`
: `${publishableReleases.length} packages`
}`
: "no changesets"
}</summary>
${
releasePlan.releases.length
publishableReleases.length
? table
: "When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types"
}
Expand Down

1 comment on commit 553f057

@vercel
Copy link

@vercel vercel bot commented on 553f057 May 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.