0.7.5 • Published 5 years ago

cli-task v0.7.5

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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

0.7.5

5 years ago

0.7.4

5 years ago

0.7.3

5 years ago

0.7.2

5 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.7

5 years ago

0.6.6

5 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.6

6 years ago

0.5.5

6 years ago

0.5.4

6 years ago

0.5.3

6 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago