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

cli-task

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-task

Task runner for developers minimalists

  • 0.7.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

cli-task

Task runner for developers minimalists

Install

$ npm install cli-task

Usage

const execa = require('execa');
const chalk = require('chalk');
const task = require('cli-task');
const jetpack = require('fs-jetpack');
const tmpPath = path.join(os.tmpdir(), 'dependency-size');

task()
    .add({
        name: 'init npm folder',
        exec: () => {
            return execa('npm', [
                'init',
                '--force'
            ], {
                cwd: tmpPath
            });
        }
    })
    .add({
        name: 'install dependency',
        exec: (state) => {
            return execa('npm', [
                'install',
                state.argv._[0]
            ], {
                cwd: tmpPath
            });
        }
    })
    .add({
        name: 'measure size',
        exec: (state) => {
            return jetpack.inspectTreeAsync(tmpPath).then(tree => {
                console.log(chalk.white(prettyBytes(tree.size)));
            });
        }
    })
    .run();

API

task.add(options)

Add a step to the task

options

Type: Object

name

Type: string

The name of the task to be displayed when being printed on the screen.

exec

Type: Function

The callback function which will be executed.

task.run()

Executes the task

Keywords

FAQs

Package last updated on 16 May 2019

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