35 lines
864 B
JavaScript
35 lines
864 B
JavaScript
const exec = require('./exec');
|
|
const gutil = require('gulp-util');
|
|
const through = require('through2');
|
|
const col = gutil.colors;
|
|
|
|
|
|
class Neko {
|
|
|
|
constructor() {
|
|
this.tag = 'Neko';
|
|
}
|
|
|
|
run() {
|
|
let stream = null;
|
|
const bufferContents = (file, enc, callback) => {
|
|
gutil.log(this.tag, col.cyan("run"), col.magenta(file.path));
|
|
|
|
exec('.', ['neko', file.path].join(' '))
|
|
.then(() => {
|
|
stream.emit('end');
|
|
callback();
|
|
})
|
|
.catch((error) => {
|
|
stream.emit('error', new gutil.PluginError({plugin: this.tag, message: error}));
|
|
callback();
|
|
});
|
|
|
|
stream.push(file);
|
|
};
|
|
|
|
return stream = through.obj(bufferContents);
|
|
}
|
|
}
|
|
|
|
module.exports = Neko; |