Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

common-bin-plus

Package Overview
Dependencies
Maintainers
11
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

common-bin-plus

advanced common-bin for cli usage

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by350%
Maintainers
11
Weekly downloads
 
Created
Source

common-bin-plus

advanced common-bin for cli usage

NPM version build status Test coverage David deps Known Vulnerabilities NPM download

Installation

npm i common-bin-plus --save

Write your own cli

see common-bin for more details.

Feature

Logger

https://github.com/unjs/consola

this.logger.info('hello info level');
this.logger.warn('hello warn level');
this.logger.error(new Error('hello error level'));
this.logger.debug('hello debug level');

debug log is disabled by default, you could enable it by:

  • command line argv: --verbose
  • process env: DEBUG=* or DEBUG=${cliName}
  • programmatically: logger.level = 'DEBUG'

Prompt

const answers = await this.prompt([
  {
    type: 'input',
    name: 'name',
    message: 'What is your name:',
  }, {
    type: 'list',
    name: 'type',
    message: 'Choose a boilerplate:',
    choices: [ 'empty', 'simple', 'plugin', 'framework' ],
  },
], {});

this.logger.info(answers);

Unit Testing

Use coffee :

const coffee = require('coffee');

describe('test/index.test.js', () => {
  it('should work', () => {
    return coffee.fork('/path/to/cli')
      // .debug()
      .waitForPrompt()
      .write('tz\n')
      .writeKey('DOWN', 'ENTER')
      .write('this is a desc\n')
      .expect('stdout', /{ name: 'tz', type: 'simple' }/)
      .expect('stdout', /{ description: 'this is a desc' }/)
      .expect('code', 0)
      .end();
  });
}):

FAQs

Package last updated on 24 May 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc