https://github.com/doowb/watch-cli
Watch files and execute an npm script when files change.
https://github.com/doowb/watch-cli
file-watcher watch watcher
Last synced: 5 months ago
JSON representation
Watch files and execute an npm script when files change.
- Host: GitHub
- URL: https://github.com/doowb/watch-cli
- Owner: doowb
- License: mit
- Created: 2014-05-12T21:18:11.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-11-02T13:41:25.000Z (almost 6 years ago)
- Last Synced: 2025-04-14T15:08:46.074Z (6 months ago)
- Topics: file-watcher, watch, watcher
- Language: JavaScript
- Size: 17.6 KB
- Stars: 60
- Watchers: 3
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# watch-cli [](http://badge.fury.io/js/watch-cli)
> Command line wrapper for gaze to use in package.json scripts object.
### Install globally
**Install globally with [npm](npmjs.org)**
```bash
npm i -g watch-cli
```## Usage
```bash
watch -p "**/*.js" -c "npm test"
```### Options
Short | Long | Type | Description
---|---|---|---
`-p` | `--pattern` | `string` | [`glob`](https://github.com/isaacs/node-glob) pattern you are want to watch.
`-c` | `--command` | `string` | Command to execute on watched files change.### Multi Patterns
It is possible to provide multi paterns, so if one of the files changed, the command will execute.
```
watch -p file1.js -p file2.fs -c command
```### Exported environment variables
Environment variables available from the command string:
```
FILENAME Relative filename.
ABSOLUTE_FILENAME Asolute filename.
EVENT Event type. Is either 'changed', 'deleted' or 'added'.
```Use it like this in Linux/macOS:
```
$ watch -p '**/*.js' -c 'jshint $FILENAME'
```In Windows:
```
> watch -p "**/*.js" -c "jshint %FILENAME%"
```## Author
**Brian Woodward**
+ [github/doowb](https://github.com/doowb)
+ [twitter/doowb](http://twitter.com/doowb)## License
Copyright (c) 2015 Brian Woodward
Released under the MIT license***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 11, 2015._