trip

2.0.0 • Public • Published

trip

The minimalist's task runner.

NPM version Linux Build Status Windows Build Status Dependency Status devDependency Status peerDependency Status


Install

> yarn global add trip
 
# or... 
> npm install trip -g

Or install it locally inside a project if you prefer.

Usage

  1. Make a tripfile.js and export some functions from it.
  2. Run the named functions from your CLI using trip FUNCTION_NAME.

You can use ES2016 syntax and it will just work.

You can run multiple tasks in series like this: > trip task1 task2 task3

Example tripfile.js

A tripfile is a module that exports some functions:

// > trip speak
export function speak() {
    console.log('Hello world!');
}
 
// > trip wow
export async function wow() {
    await somePromise();
}
 
// > trip
export async default function () {
    console.log('this is the default task');
}

Flags

You can pass boolean flags from the command line, using : as a delimiter.

For example, the command > trip foo:bar:baz will call the foo function with the flags { bar: true, baz: true }.

// run this with `trip speak:leaving:polite` to set enable the flag
export function speak({ leaving }) {
    console.log((leaving ? 'Goodbye' : 'Hello') + ' world!');
}

ES2016

Your tripfile is automatically compiled with Babel. Trip uses the env and preset and most stage-0 features by default, so you don't need to bring your own Babel config. But if you do have your own config in a .babelrc or package.json, Babel will use that instead.

Async tasks

Trip understands several kinds of async:

  • async functions
  • functions that return promises
  • functions that return streams
  • functions that explicitly accept a done callback as a second argument (for compatibility with old APIs)

When you run multiple tasks from one command (> trip task1 task2), trip waits for each task to finish before starting the next.

License

MIT © Callum Locke

Readme

Keywords

none

Package Sidebar

Install

npm i trip

Weekly Downloads

17

Version

2.0.0

License

MIT

Last publish

Collaborators

  • callumlocke
  • trip