0.3.0 • Published 8 years ago

quickscope v0.3.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

quickscope Build Status

Quickly react to dependecy changes

Huh?

Quickscope is a watcher that watches given glob and all its dependencies. This is absolutely perfect for test running (see quickscope-cli)

Getting started

npm install quickscope

API

const Quickscope = require('quickscope');
let qs = new Quickscope('glob', [{ opts }]);

// Register to event
qs.on('event', function () {});

returns quickscope instance

Params
  • glob - glob or file for watching (required)
    example: **/__tests__/*.js

  • options - additional options
    cwd - cwd...

Methods
  • on - registers for quickscope events
Events
  • ready - all input files have gone through their initial load phase
  • add - target that matches the glob has been added
  • unlink - target has been removed
  • change - target or dependency has changed

Example

let quickscope = new Quickscope('**/__tests__/*.js');

quickscope.on('ready', function (files) {
  console.log('ready with targets', files);
});

quickscope.on('add', function (file) {
  console.log('Added new target', file);
});

quickscope.on('unlink', function (file) {
  console.log('Unlinked target', file);
});

quickscope.on('change', function (deps) {
  console.log('List of dependencies changed', deps);
});

Testing

npm test

License

MIT