Spies for any changes in directory, such as
- create
- remove
- change
- rename
$ npm install -g spier
$ spy --help
$ spy -d . --ignore .idea\|.git --filter \/js\/\|\/less\/
Spier = require('spier');
spier = new Spier('src');
ftype = function (file) {
return file.stat.isDirectory() ? 'directory' : 'file';
};
spier.on( 'create', function (file) {
console.log( 'create' + ' ' + ftype(file) + ' ' + file.path );
});
spier.on( 'remove', function (file) {
console.log( 'remove' + ' ' + ftype(file) + ' ' + file.path );
});
spier.on( 'change', function (file) {
console.log( 'change' + ' ' + ftype(file) + ' ' + file.path );
});
spier.on( 'rename', function (from, to, file) {
console.log( 'rename', ftype(file), from, to );
});
spier.spy();