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

Add --prettier flag for Prettier-formatted changelogs #155

Merged
merged 6 commits into from
Sep 22, 2023

Conversation

danroc
Copy link
Contributor

@danroc danroc commented Sep 22, 2023

This PR adds a new --prettier flag. When enabled, this flag signals that the tool should expect the changelog to be formatted using Prettier. By default, this flag is set to false, ensuring backward compatibility with all existing CHANGELOG.md files.

The primary motivation for this change is to overcome a current limitation of auto-changelog. At present, our tool does not support the changelog format provided by Keep a Changelog (version ^1.1.0).

Fixes: #60

@danroc danroc force-pushed the feature/use-prettier branch from 976f9ce to 79caa80 Compare September 22, 2023 11:52
@danroc danroc marked this pull request as ready for review September 22, 2023 12:28
@danroc danroc requested a review from a team as a code owner September 22, 2023 12:28
Copy link
Member

@Mrtenz Mrtenz left a comment

Choose a reason for hiding this comment

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

Rather than running Prettier programatically, couldn't we just remove the changelog from the ignore list, and disable formatting with a flag?

https://github.com/MetaMask/metamask-module-template/blob/main/package.json#L45

@danroc
Copy link
Contributor Author

danroc commented Sep 22, 2023

I'm not sure. The update command would need to be paired with an external formater everytime it's executed. But we could add another flag (--ignore-formatting?) available only for validate.

@Mrtenz
Copy link
Member

Mrtenz commented Sep 22, 2023

I'm not sure. The update command would need to be paired with an external formater everytime it's executed. But we could add another flag (--ignore-formatting?) available only for validate.

We run Prettier regardless, hence why it's currently ignored.

@Gudahtt
Copy link
Member

Gudahtt commented Sep 22, 2023

Not always at the same time as updating the changelog though.

There's also the validate command; it's sensitive to formatting changes so we'd need to run prettier programmatically during validation to avoid breaking that.

@danroc
Copy link
Contributor Author

danroc commented Sep 22, 2023

If we ignore formating, enforcing that the sections are always in the same order may be more complex.

Yes @Gudahtt, this is why I passed the formatter to both validate and update commands.

@Mrtenz
Copy link
Member

Mrtenz commented Sep 22, 2023

Ok, makes sense!

@danroc
Copy link
Contributor Author

danroc commented Sep 22, 2023

If we are not willing to add a formatter, I suppose I could workaround like this:

Replace update with:

auto-changelog update && prettier

And replace validate with:

auto-changelog validate --fix && prettier

and then check if the CHANGELOG.md file changed, although it's not very elegant.

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@danroc danroc merged commit 703a6d8 into main Sep 22, 2023
19 checks passed
@danroc danroc deleted the feature/use-prettier branch September 22, 2023 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatibilities with some markdownlint rules
3 participants