Home

Awesome

vantage-watch

<img src="https://travis-ci.org/vantagejs/vantage-watch.svg" alt="Build Status" />

Listens for changes in Vantage.js extension files, and reloads the extensions without interrupting your app's lifecycle.

Useful when developing new Vantage commands.

Installation

npm install vantage-watch
npm install vantage

Usage

const Vantage = require('vantage');
const watch = require('vantage-watch');
const commands = require('./lib/vantage-commands');

let vantage = new Vantage();

vantage
  .listen(4000)
  .use(commands)
  .use(watch, {
    files: ['./lib/vantage-commands.js']
  })
  .show();

Now, whenever ./lib/vantage-commands.js is changed, Vantage will import and update its existing commands and / or register new commands.

Error Handling

If the watched file is not a valid Vantage extension, vantage-watch will gracefully catch the error and not attempt to load the module until it has been changed again, at which point it will retry. Examples of invalid imports include:

License

MIT