mirror of
https://github.com/archtechx/airwire.git
synced 2025-12-12 02:34:04 +00:00
23 lines
600 B
JavaScript
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;
|