Skip to content

refactor(generate:changeset): Condense front matter into single section #24251

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

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Apr 4, 2025

Our custom changeset metadata is in its own separate front-matter section. However, most tools do not recognize more than one front-matter section, so this has not been an ideal solution when we want to use other tools on our changesets (e.g. review tools, formatters, linting tools, etc.).

This change condenses the fron matter into a single section, using __ to prefix fluid-specific properties.

We already have to remove custom metadata when producing changelogs so that process has just been updated to remove the custom properties rather than the second front matter section.

The motivator for this change is to make it easier to use markdown-aware tools with our changesets. See #24252 for an example.

@github-actions github-actions bot added base: main PRs targeted against main branch area: build Build related issues labels Apr 4, 2025
@tylerbutler tylerbutler marked this pull request as ready for review April 4, 2025 00:36
@Copilot Copilot AI review requested due to automatic review settings April 4, 2025 00:36
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (3)

build-tools/packages/build-cli/src/library/changesets.ts:250

  • [nitpick] Consider defining a constant for the custom prefix '__' to improve maintainability and avoid hardcoding.
if (key.startsWith("__")) {

build-tools/packages/build-cli/src/commands/generate/changeset.ts:432

  • [nitpick] Review the removal of extra front matter separators to ensure that the resulting format is consistently parsed downstream; a brief explanatory comment might improve clarity for future maintainers.
if (additionalMetadata !== undefined) {

build-tools/packages/build-cli/src/commands/generate/changelog.ts:118

  • Verify that filtering out keys with the '__' prefix reliably excludes all Fluid-specific metadata, ensuring that changelog outputs only include package version bump information.
.filter(([key]) => !key.startsWith("__"))

const packageBumpTypeMetadata = firstParse.data;

// If there is a second frontmatter section, parse it as the additional metadata.
const hasAdditionalMetadata = hasFrontMatter(firstParse.content);
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to have been the only use of hasFrontMatter... build-tools doesn't complain about unused imports?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, looks like the tsconfig option is disabled but the lint rule is not enabled. I'll follow up with another change to enable the lint rule and fix violations.

Copy link
Member Author

Choose a reason for hiding this comment

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

Follow up PR: #24272

@tylerbutler tylerbutler merged commit b35ec44 into microsoft:main Apr 7, 2025
32 checks passed
@tylerbutler tylerbutler deleted the bt-changeset-format branch April 7, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build Build related issues base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants