
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
yargs-builder
Advanced tools
Yargs is a fantastic module, but I'm not a fan of chaining lots of methods together. This is essentially a wrapper to make it possible to get all the piratey goodness of yargs but in a more declarative manner.
Here's a quick example cribbed from the yargs module itself
line_count.js
#!/usr/bin/env node
var yargBuilder = require('yargBuilder');
var argv = yargBuilder({
usage: 'Usage: $0 <command> [options]',
command: { count: 'Count the lines in a file' },
example: { '$0 count -f foo.js': 'count the lines in the given file' },
options: {
f: { demand: true, nargs: 1, alias: 'file', describe: 'Load a file' }
},
help: 'h',
alias: { h: 'help' },
epilog: 'Borrowed from Yargs, Copyright 2015'
}).argv;
var fs = require('fs');
var s = fs.createReadStream(argv.file);
var lines = 0;
s.on('data', function (buf) {
lines += buf.toString().match(/\n/g).length;
});
s.on('end', function () {
console.log(lines);
});
$ node line_count.js count
Usage: line_count.js <command> [options]
Commands:
count Count the lines in a file
Options:
-f, --file Load a file [required]
-h, --help Show help [boolean]
Examples:
line_count.js count -f foo.js count the lines in the given file
Borrowed from Yargs, Copyright 2015
Missing required arguments: f
$ node line_count.js count --file line_count.js
26
$ node line_count.js count -f line_count.js
26
FAQs
Use yargs more declaratively
The npm package yargs-builder receives a total of 4 weekly downloads. As such, yargs-builder popularity was classified as not popular.
We found that yargs-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.