feat: Add option to use Oxfmt for formatting changelog#283
Conversation
|
@metamaskbot publish-preview |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution MetaMask internal reviewing guidelines:
|
|
@metamaskbot publish-preview |
|
A preview build for this branch has been published. You can configure your project to use the preview build with this identifier: See these instructions for more information about preview builds. |
|
@metamaskbot publish-preview |
|
A preview build for this branch has been published. You can configure your project to use the preview build with this identifier: See these instructions for more information about preview builds. |
| // If the deprecated `--prettier` flag is used, it takes precedence over the | ||
| // `--formatter` option. Otherwise, use the specified formatter, unless it's | ||
| // "none". | ||
| if (typeof usePrettier === 'boolean') { | ||
| if (usePrettier) { | ||
| return await format(changelog, 'prettier'); | ||
| } | ||
|
|
||
| return changelog; | ||
| } | ||
|
|
||
| if (formatterOption && formatterOption !== 'none') { | ||
| return await format(changelog, formatterOption as FormatterName); | ||
| } | ||
|
|
||
| return changelog; |
There was a problem hiding this comment.
This is a little bit verbose, but needed for backwards compatibility with --no-prettier.
mcmire
left a comment
There was a problem hiding this comment.
Tested these changes in core and they seem to work well.
LGTM.
This adds a new
--formatteroption, which can be set to either "prettier" or "oxfmt", and deprecates the--prettieroption. I've also refactored the logic to load Prettier dynamically, so both Oxfmt and Prettier are now optional peer dependencies.Tested in
MetaMask/core:Note
Medium Risk
Moderate risk: changes CLI flags and formatting behavior via dynamic imports, which could affect consumers relying on the deprecated
--prettierflag or missing optional peer deps at runtime.Overview
Adds a new
--formatterCLI option to choose changelog formatting (prettieroroxfmt, withnoneforvalidate) and deprecates the legacy--prettierflag (which still takes precedence when provided).Refactors changelog formatting to route through new
src/formatters.tshelpers that dynamically import Prettier/Oxfmt and throw clearer errors when the chosen formatter isn’t installed, and updates tests and package metadata to treatprettier/oxfmtas optional peer dependencies.Reviewed by Cursor Bugbot for commit b0fc35a. Bugbot is set up for automated code reviews on this repo. Configure here.