Packages

commander

15.1.0 · 7 Nov 2026MIT785.6M / weekRepositoryHomepagenpmAtom feed

Your version

9.0.0

major29 Jan 2022Where it was published

9.5.0 is the newest release of 9.x.

In short

3 breaking1 removed9 new1 fixed4 changed

  • Breaking
    • Commander 9 requires Node.js v12.20.0 or higher

  • Breaking
    • default value specified for boolean option now always used as default value (see .preset() to match some previous behaviours)

  • Breaking
    • removed internal fallback to require.main.filename when script not known from arguments passed to .parse() (can supply details using .name(), and .executableDir() or executableFile)

  • Removed

    Removed restriction that nested subcommands must specify executableFile

Release note

Added

  • Simpler ECMAScript import

  • Option.preset() allows specifying value/arg for option when used without option-argument (especially optional, but also boolean option)

  • .executableDir() for custom search for subcommands

  • Throw with helpful message if pass Option to .option() or .requiredOption()

  • .error() for generating errors from client code just like Commander generated errors, with support for .configureOutput (), .exitOverride(), and .showHelpAfterError() (#1675)

  • .optsWithGlobals() to return merged local and global options

Changed

  • Breaking
    • Commander 9 requires Node.js v12.20.0 or higher

  • Update package-lock.json to lockfile@2 format

  • showSuggestionAfterError is now on by default

  • Breaking
    • default value specified for boolean option now always used as default value (see .preset() to match some previous behaviours)

  • Default value for boolean option only shown in help if true/false

  • Use command name as prefix for subcommand stand-alone executable name (with fallback to script name for backwards compatibility)

  • Allow absolute path with executableFile

  • Removed

    Removed restriction that nested subcommands must specify executableFile

  • TypeScript: Allow passing readonly string array to .choices()

  • TypeScript: Allow passing readonly string array to .parse(), .parseAsync(), .aliases()

Fixed

  • Option with optional argument not supplied on command line now works when option already has a value, whether from default value or from previous arguments

Removed

  • Breaking
    • removed internal fallback to require.main.filename when script not known from arguments passed to .parse()
      (can supply details using .name(), and .executableDir() or executableFile) (#1571)

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.