# cha-target

> Target extension for cha.

Latest version **0.1.1** (published 2014-03-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install cha-target
pnpm add cha-target
yarn add cha-target
bun add cha-target
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-03-16 |
| First published | 2014-03-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | yuanyan |
| Maintainers | yuanyan |
| Keywords | cha, extension, target |

## Links

- npm: https://www.npmjs.com/package/cha-target
- Repository: https://github.com/chajs/cha-target
- Issues: https://github.com/chajs/cha-target/issues
- npm.io page: https://npm.io/package/cha-target

## Dependencies (2)

- [nopt](https://npm.io/package/nopt.md) ^2.2.0
- [es6-promise](https://npm.io/package/es6-promise.md) ^0.1.1

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-03-16
- 0.1.0 — 2014-03-16

## README

cha-target
==========
> Target extension for cha.

## How to setting targets?

```js
var cha = require('cha')
var tasks = require('./tasks')

// Require target extension.
cha.target = require('cha-target')

cha.in('read',     tasks.read)
    .in('glob',    tasks.glob)
    .in('cat',     tasks.cat)
    .in('coffee',  tasks.coffee)
    .in('write',   tasks.write)
    .in('uglifyjs',tasks.uglifyjs)


function input(source){
    source
        .coffee()
        .cat()
        .uglifyjs()
        .write('./out/foobar3.js')
}

// Setting a "dev" target.
cha.target('dev', function(){

    // Require watch extension.
    cha.watch = require('cha-watch')

    // Start watcher.
    cha.watch('./fixtures/coffee/*.coffee', {
        cwd: __dirname,
        immediately: true
    }, function(filepath, event, watched){

        input(cha().read(watched))

    })
})

// Setting a "dist" target.
cha.target('dist', function(){

    input(cha().glob({
        patterns: './fixtures/coffee/*.coffee',
        cwd: __dirname
    }))

})

// Setting a "all" target.
cha.target('all', ['dev', 'dist'])

// Running target.
// cha.target.run('all')

```

Add a arbitrary command to the `scripts` object:
```json
"dev": "node ./test/target dev",
"dist": "node ./test/target dist",
```

To run the command we prepend our script name with run:
```sh
$ npm run dev

> cha@0.1.1 dev /cha
> node ./test/target dev

read /cha/test/fixtures/coffee/bar.coffee
read /cha/test/fixtures/coffee/foo.coffee
concat /cha/test/fixtures/coffee/bar.coffee,/cha/test/fixtures/coffee/foo.coffee
write ./out/foobar3.js
```

---
_Source: https://npm.io/package/cha-target · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
