Skip to content

chore(read): replace deprecated git-raw-commits with git-client#4860

Merged
escapedcat merged 1 commit into
conventional-changelog:masterfrom
igordanchenko:chore/retire-git-raw-commits
Jul 1, 2026
Merged

chore(read): replace deprecated git-raw-commits with git-client#4860
escapedcat merged 1 commit into
conventional-changelog:masterfrom
igordanchenko:chore/retire-git-raw-commits

Conversation

@igordanchenko

Copy link
Copy Markdown
Contributor

git-raw-commits is deprecated in favor of @conventional-changelog/git-client, which is now used directly via GitClient.getRawCommits.

Description

Replaces the deprecated git-raw-commits dependency in @commitlint/read with its official successor, @conventional-changelog/git-client.

  • getHistoryCommits now reads history through new GitClient(cwd).getRawCommits(...) instead of the standalone getRawCommits function.
  • cwd is passed to the GitClient constructor (previously passed inline per call).
  • The GitOptions type is replaced by a local HistoryCommitsOptions (GitLogParams & Record<string, unknown>), since the client exposes GitLogParams.
  • Drops the now-unnecessary @types/git-raw-commits dev dependency — the client ships its own types.
  • Dependency pinned as ^3.0.0 (resolves to 3.0.1).

Motivation and Context

  1. git-raw-commits is deprecated and no longer maintained; its own deprecation notice recommends migrating to @conventional-changelog/git-client. This keeps @commitlint/read on a supported dependency with no intended change in behavior.

  2. This migration removes the deprecation warning that end users see when installing commitlint packages:

% npm i -D @commitlint/cli @commitlint/config-conventional
npm warn deprecated git-raw-commits@5.0.1: Deprecated and no longer maintained. Use @conventional-changelog/git-client instead.

Usage examples

No user-facing API or configuration change — behavior is unchanged. Reading commit messages from a range continues to work as before:

commitlint --from HEAD~10 --to HEAD

How Has This Been Tested?

  • @commitlint/read unit tests pass (including get-history-commits).
  • Type-checking is clean (tsc --noEmit) and Vitest reports no type errors.
  • Verified the new dependency resolves and the direct git-raw-commits@5 dependency is no longer pulled in by @commitlint/read.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have verified that any documentation examples I added/changed actually work.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • For a feature/bug fix, my commits follow the test-driven flow: a failing-test commit, then the implementation.

`git-raw-commits` is deprecated in favor of `@conventional-changelog/git-client`,
which is now used directly via `GitClient.getRawCommits`.
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Replace deprecated git-raw-commits with @conventional-changelog/git-client

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Replace deprecated git-raw-commits with @conventional-changelog/git-client.
• Switch history reading to GitClient.getRawCommits while preserving skip handling.
• Drop @types/git-raw-commits and refresh lockfile to remove deprecated transitive deps.
Diagram

graph TD
  A["read.ts"] --> B["get-history-commits.ts"] --> C(["GitClient (git-client)"]) --> D[/"git log"/]
  subgraph Legend
    direction LR
    _mod["Module"] ~~~ _lib(["Library"]) ~~~ _ext[/"External process"/]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Introduce an internal Git adapter module
  • ➕ Isolates third-party git library API changes behind a stable internal interface
  • ➕ Eases future migrations (or swapping implementations) without touching read/get-history-commits
  • ➖ Adds extra indirection for a small surface area
  • ➖ May be unnecessary overhead given the current limited usage
2. Keep git-raw-commits temporarily (defer migration)
  • ➕ Minimizes dependency and lockfile churn today
  • ➕ Avoids any subtle behavioral differences between wrappers
  • ➖ Continues exposing end users to deprecation warnings
  • ➖ Stays on an unmaintained dependency with growing ecosystem risk

Recommendation: Proceed with the current approach: migrating directly to @conventional-changelog/git-client is the most aligned with upstream guidance and removes the deprecation warning with minimal surface-area change. Consider a small internal adapter only if additional git-history consumers appear or if future churn in GitClient APIs is expected.

Files changed (4) +59 / -81

Refactor (2) +16 / -15
get-history-commits.tsUse GitClient.getRawCommits and define local options type +12/-10

Use GitClient.getRawCommits and define local options type

• Migrates history reading to instantiate GitClient with cwd and stream commits via client.getRawCommits(). Replaces GitOptions with a local HistoryCommitsOptions based on GitLogParams, while preserving backward-compatible manual handling for skip and arbitrary args.

@commitlint/read/src/get-history-commits.ts

read.tsAdopt HistoryCommitsOptions and update git-client references +4/-5

Adopt HistoryCommitsOptions and update git-client references

• Updates type usage to HistoryCommitsOptions when constructing git log parameters. Adjusts inline comments to reference the git client rather than git-raw-commits.

@commitlint/read/src/read.ts

Other (2) +43 / -66
package.jsonSwap git-raw-commits for @conventional-changelog/git-client +2/-3

Swap git-raw-commits for @conventional-changelog/git-client

• Replaces the deprecated git-raw-commits dependency with @conventional-changelog/git-client. Removes the redundant @types/git-raw-commits dev dependency since the new package ships types.

@commitlint/read/package.json

pnpm-lock.yamlRefresh lockfile for git-client v3 and remove git-raw-commits types +41/-63

Refresh lockfile for git-client v3 and remove git-raw-commits types

• Updates the lockfile to reflect @conventional-changelog/git-client@3.x and removes git-raw-commits and @types/git-raw-commits entries. Pulls in updated transitive dependencies consistent with the new git-client version constraints.

pnpm-lock.yaml

@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

Safe to merge — the change is a direct like-for-like dependency swap with no user-facing API or behavioural differences.

The migration is mechanically straightforward: git-raw-commits already wrapped @conventional-changelog/git-client internally, so the new code calls the same underlying operations directly. The manual skip handling, the cwd fallback to process.cwd(), and the existing test covering --skip 1 all remain intact. Transitive lockfile bumps are well-scoped and the new engine requirement (>=22) is already met by the package's own constraint.

No files require special attention.

Important Files Changed

Filename Overview
@commitlint/read/src/get-history-commits.ts Replaces git-raw-commits import with GitClient from @conventional-changelog/git-client; introduces HistoryCommitsOptions type; skip handling and cwd fallback remain functionally equivalent
@commitlint/read/src/read.ts Swaps GitOptions import for HistoryCommitsOptions from the local module; comment references updated; no logic changes
@commitlint/read/package.json Replaces git-raw-commits ^5.0.0 dependency with @conventional-changelog/git-client ^3.0.0; removes @types/git-raw-commits dev dependency (new package ships its own types)
pnpm-lock.yaml Lockfile correctly reflects the dependency swap plus transitive updates (@simple-libs/child-process-utils 1→2, conventional-commits-parser peer 6→7, semver 7.7.2→7.8.5 across unrelated snapshots); all engine requirements align with the >=22.12.0 constraint already in package.json

Reviews (1): Last reviewed commit: "chore(read): replace deprecated git-raw-..." | Re-trigger Greptile

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Informational

1. Deprecation warnings remain 🐞 Bug ⚙ Maintainability
Description
Although @commitlint/read no longer depends on git-raw-commits@5, the repo still includes deprecated
git-raw-commits@3.0.0 transitively (e.g., via conventional-changelog-core), so install-time
deprecation warnings may still appear. This is not a runtime bug, but it can undermine the PR’s
stated goal of eliminating deprecation warnings for end users.
Code

@commitlint/read/package.json[R39-40]

+    "@conventional-changelog/git-client": "^3.0.0",
    "tinyexec": "^1.0.0"
Evidence
The lockfile still resolves a deprecated git-raw-commits package and shows it being pulled in via
conventional-changelog packages, meaning installs can still emit deprecation warnings despite
@commitlint/read’s direct migration.

pnpm-lock.yaml[3322-3326]
pnpm-lock.yaml[7355-7364]
pnpm-lock.yaml[7406-7414]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Even after migrating `@commitlint/read` off `git-raw-commits@5`, the lockfile still contains `git-raw-commits@3.0.0` marked as deprecated, pulled in by other dependencies (e.g. `conventional-changelog-core`). If the intent is to fully remove install-time deprecation warnings, additional dependency upgrades/overrides are needed.

### Issue Context
- `@commitlint/read` now depends on `@conventional-changelog/git-client`.
- `pnpm-lock.yaml` still resolves deprecated `git-raw-commits@3.0.0` via other packages.

### Fix Focus Areas
- pnpm-lock.yaml[3322-3326]
- pnpm-lock.yaml[7355-7364]
- pnpm-lock.yaml[7406-7414]
- @commitlint/read/package.json[36-45]

### Suggested remediation
- Upgrade the transitive packages that still depend on `git-raw-commits` (e.g. `conventional-changelog-core` / `conventional-recommended-bump`) to versions that use `@conventional-changelog/git-client`, **or**
- Add a workspace-level override/resolution strategy (if acceptable in this repo) to eliminate deprecated packages from the dependency tree.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread @commitlint/read/package.json
@igordanchenko

Copy link
Copy Markdown
Contributor Author

Code Review by Qodo

  1. Deprecation warnings remain

Thanks for flagging this. As I noted in the review above, this finding isn't entirely accurate.

It's true that git-raw-commits still appears in the dependency graph, but it's no longer a dependency of any published commitlint package that end users install — it's now only present as a transitive dev/tooling dependency.

Tracing where it comes from:

git-raw-commits@3.0.0
├─┬ conventional-changelog-core@5.0.1
│ └─┬ lerna@9.0.7
│   ├── @commitlint/config-lerna-scopes@21.2.0 (dependencies)
│   └── @commitlint/root@1.0.0 (devDependencies)
└─┬ conventional-recommended-bump@7.0.1
  └── lerna@9.0.7 [deduped]

Every path ends at lerna (release tooling + the opt-in @commitlint/config-lerna-scopes). The PR's target install — npm i -D @commitlint/cli @commitlint/config-conventional — pulls neither, so the git-raw-commits@5 warning users actually saw is gone. The remaining git-raw-commits@3 is reachable only through lerna and is out of scope here.

@escapedcat

Copy link
Copy Markdown
Member

Thanks!

@escapedcat escapedcat merged commit d2fa395 into conventional-changelog:master Jul 1, 2026
12 checks passed
@igordanchenko igordanchenko deleted the chore/retire-git-raw-commits branch July 1, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants