1
0
Fork 0
mirror of https://github.com/archtechx/airwire.git synced 2025-12-12 02:34:04 +00:00
airwire/resources/js/AirwireWatcher.js
Samuel Štancl 28e16d6bef write readme
2021-05-20 22:38:02 +02:00

23 lines
600 B
JavaScript

const exec = require('child_process').exec;
class AirwireWatcher {
constructor(chodikar, files = 'app/**/*.php') {
this.chodikar = chodikar;
this.files = files;
}
apply(compiler) {
compiler.hooks.afterEnvironment.tap('AirwireWatcher', () => {
this.chodikar
.watch(this.files, { usePolling: false, persistent: true })
.on('change', this.fire);
});
}
fire() {
exec('php artisan airwire:generate');
console.log('Rebuilding Airwire definitions');
}
}
module.exports = AirwireWatcher;