Execute specified command on file change(s)
$ npm install [-g] big-eye
$ eye --help
Usage
$ eye <command>
Options
-w, --watch Files/directories to be watched [Default: pwd]
-i, --ignore Files/directories to be ignored [Default: from .gitignore]
-l, --lazy Don't execute command on startup
-d, --delay Debounce delay in ms between command executions [Default: 100]
-q, --quiet Print only command output
Examples
$ eye app.js
$ eye build.js -w src/
$ eye python module.py -i '*.pyc'
$ eye 'g++ main.cpp && ./a.out'
Tips
Run eye without arguments to execute the npm start script.
Execute file
with args
when a file matching the options.watch
array
gets modified. Returns a new Eye
instance.
Type: String
Absolute path to the file to be executed. Must be a non-empty String
.
Type: Array
Arguments that will be passed to child process when executing file
.
Type: Object
Options object that can take the following keys:
Type: Array
, String
Path(s) to files, dir(s) to be watched recursively, or glob pattern(s).
Type: anymatch compatible definition
Path(s) to files, dir(s) to be ignored, regex(es), or glob pattern(s).
Type: Boolean
Default: false
If set to true
, don't execute file
after constructing the instance, but
only on watched file change.
Type: Number
Default: 100
Delay in ms when debouncing execution after file changes.
Each Eye
instance inherits from EventEmitter
and emits a handful of events:
When a new child process is spawned. ref
is an instance of
child_process
.
Debounced file changes that trigger spawning a child process. file
is a path
to the file that caused the event.
When a child has exited. time
is its execution time in
miliseconds, code
is its exit code.
When a child was killed due to file changes, signal
represents the signal
used to ๐ช it.
MIT ยฉ nikersify