-
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add automated dependency bump checker and changelog validator #186
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
base: main
Are you sure you want to change the base?
Conversation
a88a703 to
e9b5b6c
Compare
e9b5b6c to
abcda3f
Compare
| await writeFile(changelogPath, await updatedChangelog.toString()); | ||
|
|
||
| stdout.write( | ||
| `✅ ${packageDirName}: Updated ${entriesToUpdate.length} and added ${entriesToAdd.length} changelog entries\n`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Grammatical pluralization gap in changelog updates
Missing singular/plural handling for the "added" count in the combined update message. When both updating and adding entries, the message always uses "changelog entries" (plural) even when only 1 entry is added. The message should use conditional pluralization like: ${entriesToAdd.length} changelog ${entriesToAdd.length === 1 ? 'entry' : 'entries'} to be grammatically correct and consistent with other messages in the codebase (see lines 340 and 420).
|
@cryptodev-2s I haven't had time to review this yet, but I have one initial thought: Should we rename |
Good point about future validation commands! However, I think
Suggestion:
Side note: Given we're adding more commands beyond release creation, we could consider renaming the package to something like |
Introduces a new tool to automatically detect dependency version changes and validate/update changelog entries accordingly. Features: - Detects dependency bumps from git diffs in package.json files - Validates changelog entries with exact version matching - Automatically updates changelogs with missing or outdated entries - Smart PR reference concatenation when updating existing entries - Dynamically reads repository URLs and package names - Validates by default with optional --fix flag for updates Usage: yarn check-dependency-bumps # Validate changelogs yarn check-dependency-bumps --fix # Auto-update changelogs yarn check-dependency-bumps --fix --pr 1234 # With PR number
Optimizes package name resolution by reading package.json inline during git diff parsing instead of in a separate enrichment pass. Changes: - Make parseDiff async to read package names inline - Remove enrichWithPackageNames function (no longer needed) - Read packageName immediately when first encountering a package - Simplify validateChangelogs and updateChangelogs signatures - Remove packageNames parameter (now part of PackageInfo) Benefits: - Single-pass processing (parse + enrich in one step) - Simpler code flow (24 lines removed) - Better data locality (package info complete at creation) - Cleaner API (functions receive unified PackageChanges structure) Test coverage maintained: 100% (339 passing tests)
9b796b6 to
88d116a
Compare
|
@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. |
1 similar comment
|
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. |
Hmm. Currently this tool is centered around release management, so adding code that doesn't strictly relate to releases feels wrong. I did see your note about renaming this tool to |
Description
Adds a new
check-depscommand to automatically detect, validate, and update dependency bump entries in CHANGELOGs.Usage
Key Features
package.jsonfiles--fixflag## [X.Y.Z]section when package version changes, or[Unreleased]otherwiseExample:
Implementation
New files:
src/check-dependency-bumps.ts+ tests (24 tests)src/changelog-validator.ts+ tests (27 tests)Modified:
src/command-line-arguments.ts- Addedcheck-depscommandsrc/main.ts- Command routingCoverage: 100% (statements, branches, functions, lines) - 340 passing tests
Testing in MetaMask/core
Note
Introduce
check-depsCLI to detect dependency bumps from git diffs, validate CHANGELOG entries, and optionally auto-update them.check-depssubcommand (viayargs) to analyzepackage.jsondiffs between refs and print JSON results.mainto supportreleaseand newcheck-deps; guardinitial-parametersfor release-only.src/changelog-validator.ts: exact-match validation against Unreleased or specific release sections; auto-add/update entries; preserve/merge PR numbers; markpeerDependenciesas BREAKING; support placeholder PRs.src/check-dependency-bumps.ts: parse diffs, detectdependencies/peerDependenciesbumps (skip dev), dedupe, detect package version bumps for release-aware targeting, resolve repo URL, and invoke validator/updater.src/types.ts.mainand CLI args.CHANGELOG.mdwith new command and usage.Written by Cursor Bugbot for commit 88d116a. This will update automatically on new commits. Configure here.