Skip to content

chore: update dependency yargs to v18 #4432#4686

Merged
escapedcat merged 2 commits into
masterfrom
chore/yargs-v18
May 2, 2026
Merged

chore: update dependency yargs to v18 #4432#4686
escapedcat merged 2 commits into
masterfrom
chore/yargs-v18

Conversation

@escapedcat

@escapedcat escapedcat commented Apr 3, 2026

Copy link
Copy Markdown
Member

Closes #4432.

yargs v18 requires Node ^20.19.0 || ^22.12.0 || >=23, which is now
satisfied after the Node 22 minimum bump (#4679). Per the
v18 migration notes, the singleton import pattern is
removed — callers must use the factory form yargs(process.argv.slice(2))
and prefer .parseSync() over the dual-typed .argv getter.

Changes

  • @commitlint/cli/package.json — bump yargs ^17.0.0^18.0.0.
  • @packages/utils/package.json — bump yargs ^17.0.0^18.0.0.
  • @packages/utils/pkg-check.js
    • Replace singleton yargs with factory yargs(process.argv.slice(2)).
    • Replace .argv with .parseSync() for explicit sync parsing.

Engine tightening

yargs v18 declares engines.node: "^20.19.0 || ^22.12.0 || >=23".
The previously merged Node 22 PR (#4679) set engines.node to ">=v22",
which allows 22.0.0–22.11.x — versions where yargs v18 will refuse to
install. This PR tightens the entire monorepo (root + 39 sub-packages)
to ">=22.12.0" so the published v21.0.0 metadata matches actual runtime
support, and drops the non-standard leading v in the engine string at
the same time. The README's Version Support and Releases line is
updated for consistency.

Not changed

  • @commitlint/cli/src/cli.ts already uses the factory form
    (yargs(process.argv.slice(2))). It still calls cli.argv rather
    than cli.parseSync(), but with no async middleware in the CLI's
    yargs chain, .argv returns the synchronous Arguments<T> and is
    fine. If CI surfaces a typing or runtime issue here, the one-line
    fix is main(cli.parseSync()).
  • @types/yargs is kept; yargs v18 does not yet ship its own
    type declarations.

@escapedcat escapedcat changed the title fix: update dependency yargs to v18 #4432 chore: update dependency yargs to v18 #4432 Apr 3, 2026
@escapedcat escapedcat force-pushed the chore/node22-dep-cleanup branch from 9c07126 to 2799909 Compare April 30, 2026 08:57
Base automatically changed from chore/node22-dep-cleanup to master April 30, 2026 09:11
- Fix singleton pattern in pkg-check.js (use yargs(process.argv.slice(2)))
- Use parseSync() instead of .argv in pkg-check.js
- Keep @types/yargs (v18 doesn't ship own types yet)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@escapedcat escapedcat marked this pull request as ready for review April 30, 2026 09:24
@escapedcat escapedcat requested a review from Copilot April 30, 2026 09:24
@qodo-code-review

Copy link
Copy Markdown
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

This comment was marked as resolved.

yargs v18 requires Node ^20.19.0 || ^22.12.0 || >=23. Tighten the
v21.0.0 envelope to match the strictest direct runtime dep so the
published metadata reflects actual support. Drop the non-standard
leading 'v' in the engine string while we're touching the field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@escapedcat escapedcat merged commit 44c3174 into master May 2, 2026
19 checks passed
@escapedcat escapedcat deleted the chore/yargs-v18 branch May 2, 2026 06:02
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