UNPKG

@the-goat/core

Version:

![npm version](https://badgen.net/npm/v/@the-goat/goat?icon=npm) ![npm downloads](https://badgen.net/npm/dt/@the-goat/goat?icon=npm) ![npm weekly downloads](https://badgen.net/npm/dw/@the-goat/goat?icon=npm) ![npm licence](https://badgen.net/npm/license/@

25 lines (22 loc) 480 B
const chokidar = require('chokidar'); /** * Base for file watch event, watches the cwd and triggers a goat event on file changes * @param {Object} events */ function watch(events) { chokidar.watch('./**/*', { ignored: [ /(^|[/\\])\../, ], persistent: true, ignoreInitial: true, }) .on('all', (event, path) => { events.emit({ event: `file:${event}`, path, properties: {}, }); }); } module.exports = watch;