Packages

yargs

18.2.0 · 20 Sep 2026MIT241.1M / weekRepositoryHomepagenpmAtom feed

Your version

17.0.0

major2 May 2021Where it was published

17.7.3 is the newest release of 17.x.

In short

9 breaking1 deprecated12 new10 fixed4 internal

  • breaking

    node: drop Node 10

  • breaking

    Implicitly private methods are now actually private

  • breaking

    Deprecated reset() method is now private (call yargs() instead).

  • breaking

    yargs-factory: refactor yargs-factory to use class

  • breaking

    .positional() now allowed at root level of yargs.

  • breaking

    coerce: coerce is now applied before validation.

  • breaking

    async: yargs now returns a promise if async or check are asynchronous.

  • breaking

    middleware: global middleware now applied when no command is configured.

Release note

Breaking changes

  • breaking

    node: drop Node 10

  • breaking

    Implicitly private methods are now actually private

  • breaking

    Deprecated reset() method is now private (call yargs() instead).

  • breaking

    yargs-factory: refactor yargs-factory to use class

  • breaking

    .positional() now allowed at root level of yargs.

  • breaking

    coerce: coerce is now applied before validation.

  • breaking

    async: yargs now returns a promise if async or check are asynchronous.

  • breaking

    middleware: global middleware now applied when no command is configured.

  • breaking

    Contains the following breaking API changes:

    • now returns a promise if handler is async.

    • onFinishCommand removed, in favor of being able to await promise.

    • getCompletion now invokes callback with err and `completions, returns promise of completions.

Features

  • Add commands alias (similar to options function)

  • Add parseSync/parseAsync method

  • Add support for showVersion, similar to showHelp

  • Adds support for async builder (#1888) (ade29b8), closes #1042

  • Allow calling standard completion function from custom one

  • Allow default completion to be referenced and modified, in custom completion

  • async: add support for async check and coerce

  • Improve support for async/await

  • locale: add Ukrainian locale

  • middleware: async middleware can now be used before validation.

  • middleware: global middleware now applied when no command is configured.

  • node: drop Node 10

Bug Fixes

  • Always cache help message when running commands (#1865) (d57ca77), closes #1853

  • async: don't call parse callback until async ops complete (#1896) (a93f5ff), closes #1888

  • builder: apply default builder for showHelp/getHelp (#1913) (395bb67), closes #1912

  • builder: nested builder is now awaited

  • coerce: options using coerce now displayed in help (#1911) (d2128cc), closes #1909

  • Completion script name clashing on bash

  • deno: use actual names for keys instead of inferring

  • Exclude positionals from default completion

  • showHelp() and .getHelp() now return same output for commands as --help

  • Zsh completion is now autoloadable

Code Refactoring

  • deprecated

    Deprecated reset() method is now private (call yargs() instead).