November: Procrastination Month
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    big-eyepublic

    Logo

    Execute specified command on file change(s)

    Travis build AppVeyor build Coveralls

    Video

    Install

    $ npm install [-g] big-eye
    

    Usage

    CLI

    $ 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.
    

    API

    bigEye(file, [args], [options])

    Execute file with args when a file matching the options.watch array gets modified. Returns a new Eye instance.

    file

    Type: String

    Absolute path to the file to be executed. Must be a non-empty String.

    args

    Type: Array

    Arguments that will be passed to child process when executing file.

    options

    Type: Object

    Options object that can take the following keys:

    watch

    Type: Array, String

    Path(s) to files, dir(s) to be watched recursively, or glob pattern(s).

    ignore

    Type: anymatch compatible definition

    Path(s) to files, dir(s) to be ignored, regex(es), or glob pattern(s).

    lazy

    Type: Boolean
    Default: false

    If set to true, don't exxecute file after constructing the instance, but only on watched file change.

    delay

    Type: Number
    Default: 100

    Delay in ms when debouncing execution after file changes.

    Events

    Each Eye instance inherits from EventEmitter and emits a handful of events:

    .on('executing', ref)

    When a new child process is spawned. ref is an instance of child_process.

    on('changes', file)

    Debounced file changes that trigger spawning a child process. file is a path to the file that caused the event.

    .on('exited', time, code)

    When a child has exited. time is its execution time in miliseconds, code is its exit code.

    .on('killed', signal)

    When a child was killed due to file changes, signal represents the signal used to 🔪 it.

    License

    MIT © nikersify

    Keywords

    none

    install

    npm i big-eye

    Downloadsweekly downloads

    1

    version

    0.1.0

    license

    MIT

    repository

    github.com

    last publish

    collaborators

    • avatar