@nofrills/tasks
Simple NPM package task builder.
Last updated 2 months ago by teegee .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nofrills/tasks 
SYNC missed versions from official npm registry.

@nofrills/tasks

npm

Introduction

tasks is a simple to use task executor that can work stand-alone using a tasks.json or in a package.json file. Tasks allows you to specify a set of commands that form a script.

Install

npm install --save @nofrills/tasks

Specifying Tasks

Simple

A task can be as simple as a command to call an executable.

{
  "tasks": {
    "echo": ["echo $0"]
  }
}

After saving to tasks.json, you can execute the command by running cli-tasks echo.

You can also specify multiple commands to run for any give task.

{
  "tasks": {
    "build": [
      "rm -rf lib",
      "tslint --project tsconfig.json --config tslint.json",
      "tsc --project tsconfig.json"
    ]
  }
}

When you run the task, it will execute the commands in order. Hopefully, you can quickly see how by using just this construct, it allows you go string together any common operating system task.

Injection

We can take it a step further by supporting injecting other tasks together.

{
  "tasks": {
    "build": [
      "[clean]",
      "[lint]",
      "[build:tsc]"
    ],
    "build:tsc": [
      "tsc --project tsconfig.json"
    ],
    "clean": [
      "rimraf lib"
    ],
    "lint": [
      "tslint --project tsconfig.json --config tslint.json"
    ]
  }
}

By using the [] syntax, we can inject another task's entries into the current location. When we run cli-tasks build, we expect it to run the tasks in order.

rimraf lib
tslint --project tsconfig.json --config tslint.json
tsc --project tsconfig.json

Prefixes

You can use prefixes before a command to let the runner know you want to do something special with this particular entry.

prefix meaning
! bail
@ capture
: exec
> spawn
# skip

When the bail [!] prefix is encountered when the command fails, all processing from further entries wiill be stopped.

When the capture [@] prefix is encountered, it will capture rather than inherit stdio streams, save for stdin.

When then exec [:] prefix is encountered, it will use exec rather than spawn.

When the spawn [>] prefix is encountered, it will use spawn, which is the default.

When the skip [#] prefix is encountered, the command will not be executed.

Advanced Tasks

So far, we've been using the short-hand for defining tasks. However, the underlying library supports a more descriptive structure.

export interface Task {
  entries: TaskEntry[]
  shell?: boolean | string
}

The Task type defines a list of entries in addition to allowing you to specify the shell to use when executing the task.

export interface TaskEntry {
  arguments?: string[]
  command: string
  name?: string
}

A TaskEntry specifies the command to run.

{
  "tasks": {
    "build": {
      "entries": [{
        "arguments": ["$0"],
        "command": "echo",
        "name": "current-shell"
      }],
      "shell": "/bin/bash"
    }
  }
}

License

Copyright 2018 NativeCode Development opensource@nativecode.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 11.0.0-canary.2                                ...           canary (5 months ago)
  • 11.0.0                                ...           latest (2 months ago)
  • 11.1.0-next.0                                ...           next (a month ago)

215 Versions

  • 11.1.0-next.0                                ...           a month ago
  • 11.0.0-next.17                                ...           a month ago
  • 11.0.0                                ...           2 months ago
  • 11.0.0-next.16                                ...           5 months ago
  • 11.0.0-next.15                                ...           5 months ago
  • 11.0.0-next.14                                ...           5 months ago
  • 11.0.0-next.13                                ...           5 months ago
  • 11.0.0-next.12                                ...           5 months ago
  • 11.0.0-next.11                                ...           5 months ago
  • 11.0.0-next.10                                ...           5 months ago
  • 11.0.0-next.9                                ...           5 months ago
  • 11.0.0-next.8                                ...           5 months ago
  • 11.0.0-next.7                                ...           5 months ago
  • 11.0.0-next.6                                ...           5 months ago
  • 11.0.0-next.5                                ...           5 months ago
  • 11.0.0-next.4                                ...           5 months ago
  • 11.0.0-next.3                                ...           5 months ago
  • 11.0.0-next.2                                ...           5 months ago
  • 11.0.0-canary.2                                ...           5 months ago
  • 11.0.0-canary.1                                ...           5 months ago
  • 11.0.0-next.1                                ...           5 months ago
  • 10.1.0-next.0                                ...           5 months ago
  • 10.0.4-canary.22                                ...           5 months ago
  • 10.0.4-canary.21                                ...           5 months ago
  • 10.0.4-canary.19                                ...           5 months ago
  • 10.0.4-canary.18                                ...           5 months ago
  • 10.0.3                                ...           7 months ago
  • 10.0.2                                ...           7 months ago
  • 10.0.0                                ...           10 months ago
  • 9.0.2                                ...           a year ago
  • 9.0.1                                ...           a year ago
  • 8.0.1-canary.1                                ...           a year ago
  • 9.0.0                                ...           a year ago
  • 8.0.1-canary.0                                ...           a year ago
  • 8.0.0                                ...           a year ago
  • 7.1.14-canary.5                                ...           a year ago
  • 7.1.14-canary.1                                ...           a year ago
  • 7.1.9-canary.18                                ...           a year ago
  • 7.1.13                                ...           a year ago
  • 7.1.12                                ...           a year ago
  • 7.1.11                                ...           a year ago
  • 7.1.10-canary.2                                ...           a year ago
  • 7.1.10                                ...           a year ago
  • 7.1.9                                ...           a year ago
  • 7.1.9-canary.16                                ...           a year ago
  • 7.1.9-canary.17                                ...           a year ago
  • 7.1.7-canary.3                                ...           a year ago
  • 7.1.8                                ...           a year ago
  • 7.1.7                                ...           a year ago
  • 7.1.6                                ...           a year ago
  • 7.1.5                                ...           a year ago
  • 7.1.4                                ...           a year ago
  • 7.1.3-canary.17                                ...           a year ago
  • 7.1.3                                ...           a year ago
  • 7.1.3-canary.6                                ...           a year ago
  • 7.1.3-canary.2                                ...           a year ago
  • 7.1.2                                ...           a year ago
  • 7.1.1                                ...           a year ago
  • 7.1.0                                ...           a year ago
  • 7.0.4-canary.0                                ...           a year ago
  • 7.0.3                                ...           a year ago
  • 7.0.2                                ...           a year ago
  • 7.0.1                                ...           a year ago
  • 7.0.0                                ...           a year ago
  • 6.8.5-canary.6                                ...           a year ago
  • 6.8.5-canary.5                                ...           a year ago
  • 6.8.5-canary.4                                ...           a year ago
  • 6.8.5-canary.1                                ...           a year ago
  • 6.8.7                                ...           a year ago
  • 6.8.6                                ...           a year ago
  • 6.8.5                                ...           a year ago
  • 6.8.5-canary.0                                ...           a year ago
  • 6.8.4                                ...           a year ago
  • 6.8.3                                ...           a year ago
  • 6.8.2                                ...           a year ago
  • 6.8.1                                ...           a year ago
  • 6.7.1-canary.12                                ...           a year ago
  • 6.7.1-canary.11                                ...           a year ago
  • 6.7.1-canary.9                                ...           a year ago
  • 6.8.0                                ...           a year ago
  • 6.7.1-canary.5                                ...           a year ago
  • 6.7.4                                ...           a year ago
  • 6.7.3                                ...           a year ago
  • 6.7.1-canary.4                                ...           a year ago
  • 6.7.1-canary.3                                ...           a year ago
  • 6.7.1-canary.1                                ...           a year ago
  • 6.7.2                                ...           a year ago
  • 6.7.1                                ...           a year ago
  • 6.7.0                                ...           a year ago
  • 6.6.5-canary.7                                ...           a year ago
  • 6.6.5-canary.5                                ...           a year ago
  • 6.6.4                                ...           a year ago
  • 6.6.3                                ...           a year ago
  • 6.6.2                                ...           a year ago
  • 6.6.1                                ...           a year ago
  • 6.5.1                                ...           a year ago
  • 6.5.0                                ...           a year ago
  • 6.3.2-canary.5                                ...           a year ago
  • 6.3.2-canary.4                                ...           a year ago
  • 6.3.2-canary.2                                ...           a year ago
  • 6.4.1                                ...           a year ago
  • 6.4.0                                ...           a year ago
  • 6.3.1                                ...           a year ago
  • 6.1.1-canary.7                                ...           a year ago
  • 6.3.0                                ...           a year ago
  • 6.1.1-canary.5                                ...           a year ago
  • 6.1.1-canary.3                                ...           a year ago
  • 6.2.1                                ...           a year ago
  • 6.2.0                                ...           a year ago
  • 6.1.0                                ...           a year ago
  • 6.0.2-canary.7                                ...           a year ago
  • 6.0.4                                ...           a year ago
  • 6.0.3                                ...           a year ago
  • 6.0.2                                ...           a year ago
  • 6.0.1                                ...           a year ago
  • 6.0.0                                ...           a year ago
  • 6.0.0-next.2                                ...           a year ago
  • 6.0.0-next.1                                ...           a year ago
  • 6.0.0-next.0                                ...           a year ago
  • 5.20.9-canary.1                                ...           a year ago
  • 5.20.9-next.0                                ...           a year ago
  • 5.20.8                                ...           a year ago
  • 5.20.8-next.2                                ...           a year ago
  • 5.20.6-canary.17                                ...           a year ago
  • 5.20.6-canary.14                                ...           a year ago
  • 5.20.6-canary.13                                ...           a year ago
  • 5.20.8-next.1                                ...           a year ago
  • 5.20.6-canary.12                                ...           a year ago
  • 5.20.8-next.0                                ...           a year ago
  • 5.20.7                                ...           a year ago
  • 5.20.7-next.0                                ...           a year ago
  • 5.20.6                                ...           a year ago
  • 5.20.6-next.1                                ...           a year ago
  • 5.20.6-canary.0                                ...           a year ago
  • 5.20.6-next.0                                ...           a year ago
  • 5.20.5                                ...           a year ago
  • 5.20.5-next.1                                ...           a year ago
  • 5.20.5-canary.2                                ...           a year ago
  • 5.20.5-next.0                                ...           a year ago
  • 5.20.4                                ...           a year ago
  • 5.20.1-next.2                                ...           a year ago
  • 5.18.0-alpha.5                                ...           a year ago
  • 5.20.1                                ...           a year ago
  • 5.20.0                                ...           a year ago
  • 5.18.0-next.6                                ...           a year ago
  • 5.18.0-next.3                                ...           a year ago
  • 5.18.0-next.1                                ...           a year ago
  • 5.18.0-next.0                                ...           a year ago
  • 5.17.1-next.5                                ...           a year ago
  • 5.17.1-next.4                                ...           a year ago
  • 5.17.1-next.3                                ...           a year ago
  • 5.17.1-next.2                                ...           a year ago
  • 5.17.1-next.1                                ...           a year ago
  • 5.17.1-next.0                                ...           a year ago
  • 5.17.0                                ...           a year ago
  • 5.17.1-alpha.67                                ...           a year ago
  • 5.17.1-next.66                                ...           a year ago
  • 5.16.0-next.39                                ...           a year ago
  • 5.16.0-alpha.37                                ...           a year ago
  • 5.16.0-alpha.36                                ...           a year ago
  • 5.16.0-alpha.0                                ...           2 years ago
  • 5.15.0-alpha.0                                ...           2 years ago
  • 5.14.0-alpha.0                                ...           2 years ago
  • 5.9.2                                ...           2 years ago
  • 5.9.1                                ...           2 years ago
  • 5.9.0                                ...           2 years ago
  • 5.8.1                                ...           2 years ago
  • 5.8.0                                ...           2 years ago
  • 5.7.1                                ...           2 years ago
  • 5.7.0                                ...           2 years ago
  • 5.6.2                                ...           2 years ago
  • 5.6.1                                ...           2 years ago
  • 5.6.0                                ...           2 years ago
  • 5.5.6                                ...           2 years ago
  • 5.5.5                                ...           2 years ago
  • 5.5.4                                ...           2 years ago
  • 5.5.3                                ...           2 years ago
  • 5.5.2                                ...           2 years ago
  • 5.5.1                                ...           2 years ago
  • 5.5.0                                ...           2 years ago
  • 5.4.3                                ...           2 years ago
  • 5.4.2                                ...           2 years ago
  • 5.4.1                                ...           2 years ago
  • 5.4.0                                ...           2 years ago
  • 5.3.1                                ...           2 years ago
  • 5.3.0                                ...           2 years ago
  • 5.2.0                                ...           2 years ago
  • 5.1.1                                ...           2 years ago
  • 5.1.0                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.1.9                                ...           2 years ago
  • 4.1.8                                ...           2 years ago
  • 4.1.7                                ...           2 years ago
  • 4.1.6                                ...           2 years ago
  • 4.1.5                                ...           2 years ago
  • 4.1.4                                ...           2 years ago
  • 4.1.3                                ...           2 years ago
  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           2 years ago
  • 4.1.0                                ...           2 years ago
  • 4.0.2                                ...           2 years ago
  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
  • 3.1.7                                ...           2 years ago
  • 3.1.0                                ...           2 years ago
  • 3.0.4                                ...           2 years ago
  • 3.0.3                                ...           2 years ago
  • 3.0.2                                ...           2 years ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.2.1                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 19
Dependencies (16)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |