diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index e8a62f50215..bd9285e6437 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -6,6 +6,24 @@
### Patch Changes
+
+`Card` - Test change multi-line
+- Change one
+- Change two
+
+
+
+`Tag` - Test change
+
+
+
+`Card` - Test change three
+
+
+
+`Link::Standalone` - Test change
+
+
`AdvancedTable` - Fixed a bug that prevented the `model` from updating when the argument changes
[#2919](https://github.com/hashicorp/design-system/pull/2919)
diff --git a/website/docs/whats-new/release-notes/partials/components.md b/website/docs/whats-new/release-notes/partials/components.md
index 91cc39953d9..92e72ad2233 100644
--- a/website/docs/whats-new/release-notes/partials/components.md
+++ b/website/docs/whats-new/release-notes/partials/components.md
@@ -18,6 +18,24 @@
**Patch changes**
+
+`Card` - Test change multi-line
+- Change one
+- Change two
+
+
+
+`Tag` - Test change
+
+
+
+`Card` - Test change three
+
+
+
+`Link::Standalone` - Test change
+
+
`AdvancedTable` - Fixed a bug that prevented the `model` from updating when the argument changes
[#2919](https://github.com/hashicorp/design-system/pull/2919)
diff --git a/website/lib/changelog/generate-component-changelog-entries.mjs b/website/lib/changelog/generate-component-changelog-entries.mjs
index 2da70591090..9e2ca8d996b 100644
--- a/website/lib/changelog/generate-component-changelog-entries.mjs
+++ b/website/lib/changelog/generate-component-changelog-entries.mjs
@@ -18,7 +18,7 @@ const readVersionFromPackageJson = (filePath) => {
};
const getComponentPaths = (baseDir) => {
- const components = {};
+ const components = [];
try {
const folders = fs.readdirSync(baseDir, { withFileTypes: true });
folders.forEach((folder) => {
@@ -26,46 +26,10 @@ const getComponentPaths = (baseDir) => {
const componentPath = `${baseDir}/${folder.name}`;
const partialsPath = `${componentPath}/partials`;
if (fs.existsSync(partialsPath)) {
- // we have some special cases where intermediate namespacing is used to group components:
- if (baseDir.endsWith('/copy')) {
- components[`copy-${folder.name}`] = componentPath;
- } else if (baseDir.endsWith('/form')) {
- if (folder.name === 'primitives') {
- const primitiveNames = [
- 'character-count',
- 'error',
- 'field',
- 'fieldset',
- 'helper-text',
- 'indicator',
- 'label',
- 'legend',
- ];
- primitiveNames.forEach((componentName) => {
- components[`form-${componentName}`] = componentPath;
- });
- } else {
- components[`form-${folder.name}`] = componentPath;
- }
- } else if (baseDir.endsWith('/layouts')) {
- if (folder.name === 'app-frame') {
- components[`${folder.name}`] = componentPath;
- } else {
- components[`layout-${folder.name}`] = componentPath;
- }
- } else if (baseDir.endsWith('/link')) {
- components[`link-${folder.name}`] = componentPath;
- } else if (baseDir.endsWith('/stepper')) {
- // The components/stepper/indicator page contains both the Stepper::Step::Indicator and Stepper::Task::Indicator
- if (folder.name === 'indicator') {
- components[`stepper-step-${folder.name}`] = componentPath;
- components[`stepper-task-${folder.name}`] = componentPath;
- } else {
- components[`stepper-${folder.name}`] = componentPath;
- }
- } else {
- components[folder.name] = componentPath;
- }
+ components.push(componentPath.replace('./docs/', ''));
+ } else {
+ // For component docs that are nested, we need to recursively get their paths
+ components.push(...getComponentPaths(componentPath));
}
}
});
@@ -91,38 +55,26 @@ const extractVersion = (changelogContent, version) => {
return match ? match[0] : null;
};
-const convertComponentNameFormat = (componentName) => {
- const twoLevelComponentNames = ['copy', 'form', 'layout', 'link', 'stepper'];
- const threeLevelComponentNames = [
- 'stepper-step-indicator',
- 'stepper-task-indicator',
- ];
- if (twoLevelComponentNames.includes(componentName.split('-')[0])) {
- let words = componentName
- .split('-')
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1));
- if (threeLevelComponentNames.includes(componentName)) {
- return words.join('::');
- } else {
- return words[0] + '::' + words.slice(1).join('');
- }
- } else {
- return componentName
- .split('-')
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
- .join('');
- }
-};
-
const extractComponentChangelogEntries = (components, lastVersionContent) => {
const componentChangelogEntries = {};
- Object.keys(components).forEach((componentName) => {
- const formattedComponentName = convertComponentNameFormat(componentName);
- const regex = new RegExp(`^\`${formattedComponentName}\` - .*$`, 'gm');
+ components.forEach((componentName) => {
+ const regex = new RegExp(
+ `^()$`,
+ 'gm',
+ );
const matches = lastVersionContent.match(regex);
if (matches) {
- componentChangelogEntries[componentName] = matches;
+ const cleanedMatches = [];
+ matches.forEach((match) => {
+ // Remove the start and end comments to get the changelog entry
+ const cleanMatch = match
+ .replace(``, '')
+ .replace(``, '')
+ .trim();
+ cleanedMatches.push(cleanMatch);
+ });
+ componentChangelogEntries[componentName] = cleanedMatches;
}
});
@@ -131,14 +83,14 @@ const extractComponentChangelogEntries = (components, lastVersionContent) => {
const updateComponentVersionHistory = (componentChangelogEntries, version) => {
Object.keys(componentChangelogEntries).forEach((componentName) => {
- const versionHistoryPath = `${allComponentsPath[componentName]}/partials/version-history/version-history.md`;
+ const versionHistoryPath = `./docs/${componentName}/partials/version-history/version-history.md`;
let versionHistoryContent = '';
if (fs.existsSync(versionHistoryPath)) {
versionHistoryContent = fs.readFileSync(versionHistoryPath, 'utf8');
} else {
fs.mkdirSync(
- `${allComponentsPath[componentName]}/partials/version-history`,
+ `./docs/${componentName}/partials/version-history/version-history`,
{ recursive: true },
);
}
@@ -149,10 +101,7 @@ const updateComponentVersionHistory = (componentChangelogEntries, version) => {
const newEntries = componentChangelogEntries[componentName]
.map((entry) => {
// If the component is a form primitive, we want to keep the component name in the description
- if (
- allComponentsPath[componentName] ===
- './docs/components/form/primitives'
- ) {
+ if (componentName === 'components/form/primitives') {
return entry;
} else {
return entry.split(' - ')[1];
@@ -167,7 +116,7 @@ const updateComponentVersionHistory = (componentChangelogEntries, version) => {
const updateComponentFrontMatter = (componentChangelogEntries, version) => {
Object.keys(componentChangelogEntries).forEach((componentName) => {
- const indexPath = `${allComponentsPath[componentName]}/index.md`;
+ const indexPath = `${allComponentPaths[componentName]}/index.md`;
if (fs.existsSync(indexPath)) {
// Fetch the index markdown file
@@ -236,6 +185,23 @@ const cleanComponentFrontMatter = (components, version) => {
});
};
+const cleanChangelogContent = (filePath) => {
+ try {
+ const content = fs.readFileSync(filePath, 'utf8');
+ const lines = content.split('\n');
+ const newLines = [];
+ lines.forEach((line) => {
+ if (!(line.startsWith('