https://github.com/jedwards1211/flow-watch
clear the console and run flow on file changes
https://github.com/jedwards1211/flow-watch
file-watcher flow flow-watch rerun watch
Last synced: about 1 year ago
JSON representation
clear the console and run flow on file changes
- Host: GitHub
- URL: https://github.com/jedwards1211/flow-watch
- Owner: jedwards1211
- License: mit
- Created: 2016-10-02T05:35:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T01:11:22.000Z (over 4 years ago)
- Last Synced: 2025-04-12T18:18:38.800Z (about 1 year ago)
- Topics: file-watcher, flow, flow-watch, rerun, watch
- Language: JavaScript
- Size: 492 KB
- Stars: 29
- Watchers: 2
- Forks: 6
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# flow-watch
A simple file watcher that clears the console and runs flow on each change. Currently tested on OS X -- I don't know
if it works on Linux or Windows. Works with `flow` on your path or `flow-bin` installed as a peer dependency.
## Usage
```
npm install --save-dev flow-watch
```
Then run the `flow-watch` command.
`flow-watch` passes known `nodemon` options to `nodemon`, and all other options
to `flow`.
## You may not need this?
`nodemon` [has a documented way to clear the console on restart](https://github.com/remy/nodemon/blob/master/faq.md#how-to-clear-the-console-on-restart), so you may want to use `nodemon`/`flow` directly
in a package script instead of using `flow-watch`.
To use `nodemon` and `flow`, you can add this to your `package.json` (tested with `nodemon@2.0.7`):
```json
{
"scripts": {
"flow:watch": "nodemon -x 'flow || exit 1'"
},
"nodemonConfig": {
"events": {
"start": "cls || clear"
}
}
}
```
## Configuration
`flow-watch` uses [`nodemon`](https://github.com/remy/nodemon) and accepts any command-line options that `nodemon` does.
If you provide no arguments, it uses the following defaults:
```
--ignore node_modules/ --watch *.js --watch *.jsx --watch *.js.flow --watch .flowconfig
```
By default, the watcher will clear the console between each change. If you wish to override this behavior, use the `FLOW_WATCH_NO_CLEAR_CONSOLE` env variable. If you choose that approach, you may also want to silent the `[nodemon]` messages in the console, which you can do with the `--quiet` flag (or `-q`). Putting it all together:
```json
{
"scripts": {
"flow:watch": "FLOW_WATCH_NO_CLEAR_CONSOLE=1 flow-watch -q"
}
}
```