
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
storbi is an opinionated framework for creating command line applications in Node. Why not commander or vorpal or insert other framework here? Well, I tried building an app with those and it just didn't feel right. So I started building my app from scratch without a framework and realized that I had built a framework in my app. A little copy and pasta and tweaking some fiddly bits and storbi was born.
import CLI from 'storbi'
class MyAwesomeCommand {
constructor() {
this.name = 'command'
}
run() {
console.log('I do awesome CLI stuff!')
}
}
const cli = new CLI(MyAwesomeCommand)
cli.run()
$> node index.js command
I do awesome CLI stuff!
See the examples directory for more ways to use storbi.
yarn add storbi
The cli constructor accepts two arguments. The list of commands and options.
const cli = new CLI([Command1, Command2], { name: 'my-tool', version: '1.0.0' })
If the options are not passed in the CLI constructor options, storbi will attempt to infer them from your package.json.
You may also pass a single command to the constructor in lieu of an Array.
A Command in storbi is any JavaScript class that has a name property and a method called run.
class Command {
constructor() {
this.name = 'command'
}
run(args) {
// Perform your command actions here
}
}
Command arguments are passed to your run method from the CLI in the form of:
{ args: ['one', 'two'], flags: { flag: value }}
A few examples
$> node index.js command --force
# { flags: { force: true } }
$> node index.js config init -r=20
# { flags: { r: '20' } }
$> node index.js new test.js
# { args: ['test.js'] }
Sub-commands are created by passing a command class to the constructor of another command class. For the sub-command to work properly the parent command class needs to extend CLI.Command
and pass it's commands to the Command
class.
const CLI = require('storbi')
class New {
constructor() {
this.name = 'new'
}
run(args) {
// Do new stuff
}
}
class Config extends CLI.Command {
constructor(cmds) {
super(cmds)
this.name = 'config'
}
}
You would then need to create an instance of the Config
class to pass to the CLI constructor. Note the lack of a run
method on the Config
class. This run method will never be called and should be omitted.
FAQs
An opinionated CLI application framework
The npm package storbi receives a total of 0 weekly downloads. As such, storbi popularity was classified as not popular.
We found that storbi 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.