# fly-watch

> Watch files & Execute specified tasks on change

Latest version **1.1.1** (published 2017-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install fly-watch
pnpm add fly-watch
yarn add fly-watch
bun add fly-watch
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2017-02-05 |
| First published | 2017-01-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.6 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Luke Edwards |
| Maintainers | lukeed |
| Keywords | fly, fly-plugin, chokidar, watch |

## Links

- npm: https://www.npmjs.com/package/fly-watch
- Repository: https://github.com/flyjs/fly-watch
- Homepage: https://github.com/flyjs/fly-watch#readme
- Issues: https://github.com/flyjs/fly-watch/issues
- npm.io page: https://npm.io/package/fly-watch

## Dependencies (2)

- [arrify](https://npm.io/package/arrify.md) ^1.0.1
- [chokidar](https://npm.io/package/chokidar.md) ^1.6.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2017-02-05
- 1.1.0 — 2017-02-03
- 1.0.0 — 2017-02-01
- 0.0.0 — 2017-01-11

## README

# fly-watch [![Build Status](https://travis-ci.org/flyjs/fly-watch.svg?branch=master)](https://travis-ci.org/flyjs/fly-watch)

> Watch files & Execute specified tasks on change

After initializing a [Chokidar](https://github.com/paulmillr/chokidar) instance, specified paths will be watched and run Tasks _serially_ in response to adding, updating, or deleting a matching filepath.

When a Task is restarted by `fly.watch`, the Task's `options.src` will contain the full path of the file that triggered a response.


## Install

```
$ npm install --save-dev fly-watch
```


## Usage

```js
module.exports = {
  * lint(fly, opts) {
    // process single file via `opts.src` if populated
    yield fly.source(opts.src || "src/*.js").eslint()
  },
  * scripts(fly, opts) {
    // process single file via `opts.src` if populated
    yield fly.source(opts.src || "src/*.js").babel({ presets: ["es2015"] }).target("dist/js")
  },
  * styles(fly) {
    yield fly.source("src/app.sass").sass().target("dist/css")
  },
  * default(fly) {
    // watch all JS files; run 'lint' then 'scripts'
    yield fly.watch("src/**/*.js", ["lint", "scripts"])
    // watch multiple paths; only run "styles"
    yield fly.watch(["src/foo/*.sass", "src/*.sass"], "styles")
  }
}
```


## API

### fly.watch(globs, tasks, [options])

#### globs

Type: `string` or `array`

A filepath, directory path, or glob pattern. Multiple paths must use an `array`.


#### tasks

Type: `string` or `array`

The task(s) to run when a matched file (from `globs`) is added, changed, or deleted. Multiple tasks must use an `array` and will run as a [serial chain](https://github.com/flyjs/fly#flyserialtasks-options).

#### options

Type: `object`<br>
Default: `{}`

Initial options to be passed to each Task. See [`fly.start`](https://github.com/flyjs/fly#flystarttask-options) for more info.


## License

MIT © [Luke Edwards](http://flyjs.io)

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