fix(read): update git-raw-commits to v5 API#4638
fix(read): update git-raw-commits to v5 API#4638escapedcat merged 3 commits intoconventional-changelog:masterfrom
Conversation
Review Summary by QodoUpdate git-raw-commits to v5 API with manual skip handling
WalkthroughsDescription• Update git-raw-commits dependency from v4 to v5 with ESM-only API • Replace default import with named exports getRawCommits and GitOptions • Implement manual skip option handling in async iterator pattern • Remove deprecated streamToPromise utility function Diagramflowchart LR
A["git-raw-commits v4<br/>Default import"] -->|"Upgrade to v5"| B["git-raw-commits v5<br/>Named exports"]
B -->|"Use getRawCommits<br/>async iterator"| C["getHistoryCommits<br/>Manual skip handling"]
D["streamToPromise<br/>utility"] -->|"Remove"| E["Inline async<br/>iteration"]
File Changes1. @commitlint/read/src/get-history-commits.ts
|
Code Review by Qodo
1. Unvalidated skip value
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Pull request overview
This PR updates @commitlint/read to use the git-raw-commits v5 API, which is ESM-only and has breaking changes. It replaces the old default import and stream-based approach with the new named exports (getRawCommits, GitOptions) and async iterables, and manually handles the --skip option that v5 no longer passes through to git log.
Changes:
- Updated
git-raw-commitsfrom^4.0.0to^5.0.0and@types/git-raw-commitsfrom^2.0.3to^5.0.0, with corresponding yarn.lock updates (adding@conventional-changelog/git-clienttransitive dependency, removingdargs,split2@^4,meow@^12). - Rewrote
get-history-commits.tsto use v5'sgetRawCommitsasync iterable API and manually implementskipbehavior viaArray.slice, since v5 no longer passes arbitrary git log args through. - Removed the now-unnecessary
stream-to-promise.tshelper.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
@commitlint/read/package.json |
Bumps git-raw-commits and @types/git-raw-commits to v5 |
@commitlint/read/src/get-history-commits.ts |
Migrates to v5 named exports and async iterable; handles skip manually |
@commitlint/read/src/stream-to-promise.ts |
Removed — no longer needed with async iterable API |
yarn.lock |
Reflects dependency tree changes for v5 migration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks |
Description
Renovate PR #4065 bumps git-raw-commits from ^4.0.0 → ^5.0.0 and @types/git-raw-commits from ^2.0.3 → ^5.0.0. The v5 release is ESM-only and has breaking API changes. The CI currently fails because the code still uses the old v4 API.
This PR updates
@commitlint/readto use the new v5 named exports (getRawCommits,GitOptions). It also fixes a bug where v5 silently drops arbitrary git log arguments (like--skip) by handling theskipoption manually in getHistoryCommits.Motivation and Context
Git-raw-commits v4 is now deprecated so an upgrade is needed. Resolves #4065.
Usage examples
No changes to public usage. Only internal API usage of
git-raw-commitswas updated.How Has This Been Tested?
Run
yarn test. Specifically ensured that the previously failingget edit commit message while skipping first committest now passes since the--skipargument is handled internally.Types of changes
Checklist: