added tasks
This commit is contained in:
35
haxetool/neko.js
Normal file
35
haxetool/neko.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const exec = require('./exec');
|
||||
const through = require('through2');
|
||||
const PluginError = require('plugin-error');
|
||||
const colors = require('ansi-colors');
|
||||
const log = require('fancy-log');
|
||||
|
||||
class Neko {
|
||||
|
||||
constructor() {
|
||||
this.tag = 'Neko';
|
||||
}
|
||||
|
||||
run(...args) {
|
||||
let stream = null;
|
||||
const bufferContents = (file, enc, callback) => {
|
||||
log(this.tag, colors.cyan("run"), colors.magenta(file.path));
|
||||
|
||||
exec('.', ['neko', file.path].concat(args).join(' '))
|
||||
.then(() => {
|
||||
stream.emit('end');
|
||||
callback();
|
||||
})
|
||||
.catch((error) => {
|
||||
stream.emit('error', new PluginError({plugin: this.tag, message: error}));
|
||||
callback();
|
||||
});
|
||||
|
||||
stream.push(file);
|
||||
};
|
||||
|
||||
return stream = through.obj(bufferContents);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Neko;
|
||||
Reference in New Issue
Block a user