Gathering detailed insights and metrics for yargs
Gathering detailed insights and metrics for yargs
Gathering detailed insights and metrics for yargs
Gathering detailed insights and metrics for yargs
npm install yargs
Typescript
Module System
Min. Node Version
Node Version
NPM Version
97.8
Supply Chain
100
Quality
86.3
Maintenance
100
Vulnerability
100
License
JavaScript (71.05%)
TypeScript (28.71%)
HTML (0.25%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
11,309 Stars
1,847 Commits
1,005 Forks
80 Watchers
82 Branches
282 Contributors
Updated on Jul 12, 2025
Latest Version
18.0.0
Package Id
yargs@18.0.0
Unpacked Size
226.01 kB
Size
46.75 kB
File Count
58
NPM Version
11.4.1
Node Version
22.15.0
Published on
May 27, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Yargs be a node.js library fer hearties tryin' ter parse optstrings
Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
It gives you:
my-program.js serve --port=5000
).mocha [spec..]
Run tests with Mocha
Commands
mocha inspect [spec..] Run tests with Mocha [default]
mocha init <path> create a client-side Mocha setup at <path>
Rules & Behavior
--allow-uncaught Allow uncaught errors to propagate [boolean]
--async-only, -A Require all tests to use a callback (async) or
return a Promise [boolean]
Stable version:
1npm i yargs
Bleeding edge version with the most recent features:
1npm i yargs@next
1#!/usr/bin/env node 2import yargs from 'yargs'; 3import { hideBin } from 'yargs/helpers'; 4const argv = yargs(hideBin(process.argv)).parse() 5 6if (argv.ships > 3 && argv.distance < 53.5) { 7 console.log('Plunder more riffiwobbles!') 8} else { 9 console.log('Retreat from the xupptumblers!') 10}
1$ ./plunder.js --ships=4 --distance=22 2Plunder more riffiwobbles! 3 4$ ./plunder.js --ships 12 --distance 98.7 5Retreat from the xupptumblers!
Note:
hideBin
is a shorthand forprocess.argv.slice(2)
. It has the benefit that it takes into account variations in some environments, e.g., Electron.
1#!/usr/bin/env node 2import yargs from 'yargs'; 3import { hideBin } from 'yargs/helpers'; 4 5yargs(hideBin(process.argv)) 6 .command('serve [port]', 'start the server', (yargs) => { 7 return yargs 8 .positional('port', { 9 describe: 'port to bind on', 10 default: 5000 11 }) 12 }, (argv) => { 13 if (argv.verbose) console.info(`start server on :${argv.port}`) 14 serve(argv.port) 15 }) 16 .option('verbose', { 17 alias: 'v', 18 type: 'boolean', 19 description: 'Run with verbose logging' 20 }) 21 .parse()
Run the example above with --help
to see the help for the application.
yargs has type definitions at @types/yargs.
npm i @types/yargs --save-dev
See usage examples in docs.
As of v16
, yargs
supports Deno:
1import yargs from 'https://deno.land/x/yargs@v17.7.2-deno/deno.ts' 2import { Arguments } from 'https://deno.land/x/yargs@v17.7.2-deno/deno-types.ts' 3 4yargs(Deno.args) 5 .command('download <files...>', 'download a list of files', (yargs: any) => { 6 return yargs.positional('files', { 7 describe: 'a list of files to do something with' 8 }) 9 }, (argv: Arguments) => { 10 console.info(argv) 11 }) 12 .strictCommands() 13 .demandCommand(1) 14 .parse()
Note: If you use version tags in url then you also have to add
-deno
flag on the end, like@17.7.2-deno
See examples of using yargs in the browser in docs.
Libraries in this ecosystem make a best effort to track Node.js' release schedule. Here's a post on why we think this is important.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
21 commit(s) and 12 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 22/27 approved changesets -- score normalized to 8
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More