-
-
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
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
e9b5b6c to
abcda3f
Compare
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)
| 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 |
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
Introduces a CLI to detect dependency bumps from git diffs and validate/update changelog entries, with command routing and comprehensive tests.
check-depscommand (src/check-dependency-bumps.ts) to detect dependency bumps from git diffs, validate changelogs, and optionally auto-fix with PR linking.src/main.ts; parse new options insrc/command-line-arguments.ts.src/changelog-validator.tsto validate and updateCHANGELOG.md(supports Unreleased and release sections, preserves/concats PRs, BREAKING for peerDeps).src/types.ts.determineInitialParametersfor release-only; tests updated accordingly.CHANGELOG.mdwithcheck-depsfeature and usage.Written by Cursor Bugbot for commit 9b796b6. This will update automatically on new commits. Configure here.