From 139a96a6c46e0bb8f67c44b7969c5bbfb5f365c8 Mon Sep 17 00:00:00 2001 From: Renato Massao Yonamine <1071799+massao@users.noreply.github.com> Date: Fri, 16 Jun 2023 16:17:49 +0200 Subject: [PATCH] fix: make changelog script work with multiline changeset (#2505) * fix: make changelog script work with multiline changeset * docs: add changeset file example --- CHANGELOG.md | 110 +++++++++++------------ RELEASES.md | 15 ++++ packages/website/content/changelog.mdx | 110 +++++++++++------------ scripts/changesets/changelog-generate.js | 9 +- 4 files changed, 131 insertions(+), 113 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b18d1c0570..936957e483 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,38 +19,38 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Button** `v4.42.0` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors **F36 Forms** `v4.42.0` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors **F36 Icon** `v4.42.0` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors **F36 Tokens** `v4.0.2` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors ## 01-06-2023 @@ -194,7 +194,7 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Badge** `v4.30.1` - feat(badge): fix letter case - feat(entity-status-badge): fix letter case +- feat(entity-status-badge): fix letter case **F36 Table** `v4.30.2` @@ -205,17 +205,17 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Icons** `v4.25.0` - feat(environment): update icon - feat(environment-alias): update icon - feat(sort-ascending): new icon - feat(sort-descending): new icon - feat(sort): new icon +- feat(environment-alias): update icon +- feat(sort-ascending): new icon +- feat(sort-descending): new icon +- feat(sort): new icon ## 14-03-2023 **F36 Menu** `v4.29.0` - feat(menu): new look and feel - feat(menu-item): add `isActive` and `isDisabled` props +- feat(menu-item): add `isActive` and `isDisabled` props **F36 Table** `v4.30.0` @@ -493,12 +493,12 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Button** `v4.21.2` - feat(button): allow icon variant for transparent buttons - fix(datepicker): change calendar button icon variant +- fix(datepicker): change calendar button icon variant **F36 Datepicker** `v4.21.2` - feat(button): allow icon variant for transparent buttons - fix(datepicker): change calendar button icon variant +- fix(datepicker): change calendar button icon variant ## 26-10-2022 @@ -577,137 +577,137 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Accordion** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Asset** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Autocomplete** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Badge** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Button** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Card** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Collapse** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Copybutton** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Datepicker** `v4.2.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Datetime** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Drag Handle** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Entity List** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Forms** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Icon** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Icons** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 List** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Menu** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Modal** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Note** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Notification** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Pagination** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Pill** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Popover** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Skeleton** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Spinner** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Table** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Tabs** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Datepicker** `v4.2.2` diff --git a/RELEASES.md b/RELEASES.md index f84d460a3b..6ec3df3ff3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -7,6 +7,9 @@ Our CI is configured to automatically bump the version and publish the packages ## Adding changesets We use the `changeset-bot` to comment on PRs when a changeset is found or not. + +Note that each line in the description will be renderd as a bullet point on our changelog. + In case the change you are making is only on documentation or you don't want to publish a new package version for the change, you don't need to do anything and can merge the PR once it's approved. But in case you want a new version to be published, you will need to add a changeset, for that you can: @@ -19,6 +22,18 @@ But in case you want a new version to be published, you will need to add a chang - `changeset-bot` will show that information in its comment on the PR. - when the PR is merged it will trigger the release job on our CI and a new version will be published. +Changesets files should be structured like: + +``` +--- +"@contentful/package-name": version change (minor, patch, major) +"@contentful/another-package": version change (minor, patch, major) +--- + +- Description of what has changed +- Another change +``` + ## Fixed versioning We use the fixed packages approach from changeset on all our component packages, and the umbrella package (`@contentful/f36-components`), the fixed packages as described on changesets documentation: diff --git a/packages/website/content/changelog.mdx b/packages/website/content/changelog.mdx index 5fe3fe889a..b15d4a30da 100644 --- a/packages/website/content/changelog.mdx +++ b/packages/website/content/changelog.mdx @@ -17,38 +17,38 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Button** `v4.42.0` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors **F36 Forms** `v4.42.0` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors **F36 Icon** `v4.42.0` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors **F36 Tokens** `v4.0.2` - feat(button): restyle negative variant - feat(textarea): change hue of invalid border color - feat(validation-message): change hue of negative color - feat(icon): change hue of negative color - feat(icon): change hue of positive color - feat(tokens): change hue of semantic colors +- feat(textarea): change hue of invalid border color +- feat(validation-message): change hue of negative color +- feat(icon): change hue of negative color +- feat(icon): change hue of positive color +- feat(tokens): change hue of semantic colors ## 01-06-2023 @@ -192,7 +192,7 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Badge** `v4.30.1` - feat(badge): fix letter case - feat(entity-status-badge): fix letter case +- feat(entity-status-badge): fix letter case **F36 Table** `v4.30.2` @@ -203,17 +203,17 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Icons** `v4.25.0` - feat(environment): update icon - feat(environment-alias): update icon - feat(sort-ascending): new icon - feat(sort-descending): new icon - feat(sort): new icon +- feat(environment-alias): update icon +- feat(sort-ascending): new icon +- feat(sort-descending): new icon +- feat(sort): new icon ## 14-03-2023 **F36 Menu** `v4.29.0` - feat(menu): new look and feel - feat(menu-item): add `isActive` and `isDisabled` props +- feat(menu-item): add `isActive` and `isDisabled` props **F36 Table** `v4.30.0` @@ -491,12 +491,12 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Button** `v4.21.2` - feat(button): allow icon variant for transparent buttons - fix(datepicker): change calendar button icon variant +- fix(datepicker): change calendar button icon variant **F36 Datepicker** `v4.21.2` - feat(button): allow icon variant for transparent buttons - fix(datepicker): change calendar button icon variant +- fix(datepicker): change calendar button icon variant ## 26-10-2022 @@ -575,137 +575,137 @@ The Changelog gives an overview of the changes we've made to Forma 36 **F36 Accordion** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Asset** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Autocomplete** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Badge** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Button** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Card** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Collapse** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Copybutton** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Datepicker** `v4.2.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Datetime** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Drag Handle** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Entity List** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Forms** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Icon** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Icons** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 List** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Menu** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Modal** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Note** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Notification** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Pagination** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Pill** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Popover** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Skeleton** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Spinner** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Table** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Tabs** `v4.19.1` - build: build ESM to JS file - legacy output - fix(notification): use type imports +- fix(notification): use type imports **F36 Datepicker** `v4.2.2` diff --git a/scripts/changesets/changelog-generate.js b/scripts/changesets/changelog-generate.js index 9706424e13..5e22232ced 100644 --- a/scripts/changesets/changelog-generate.js +++ b/scripts/changesets/changelog-generate.js @@ -29,9 +29,12 @@ function getPackageName(name) { function getReleaseSummary(changesets, release) { const formattedChangesets = release.changesets.map((changeset) => { const { summary } = changesets.find((cs) => cs.id === changeset) ?? {}; - return !summary || summary?.trim().startsWith('-') - ? summary - : `- ${summary} \n`; + const changes = summary.split('\n'); + return changes + .map((change) => + !change || change?.trim().startsWith('-') ? change : `- ${change}\n`, + ) + .join(''); }); const subPackageName = `**${getPackageName(release.name)}** \`v${