[build] added gulp builder

This commit is contained in:
2017-12-17 22:29:16 +03:00
parent 823799e8fb
commit 69c2b735a0
24 changed files with 1273 additions and 4 deletions

41
tasks/debug.js Executable file
View File

@@ -0,0 +1,41 @@
const gulp = require('gulp');
const gutil = require('gulp-util');
const col = gutil.colors;
const net = require('net');
const through = require('through2');
const color = (level) => {
return {
'[DEBUG]': col.white,
'[INFO]': col.cyan,
'[ERROR]': col.red,
'[WARNING]': col.yellow,
}[level] || col.reset;
};
const log = (line) => {
const result = line.split(' ');
console.log(col.gray(result[0]) + ' ' + color(result[1])(result.slice(1).join(' ')));
};
module.exports = () => {
return through.obj(function (file, enc, callback) {
const server = net.createServer((socket) => {
socket.on("data", (data) => {
const lines = data.toString().split('\n');
for (let line of lines) if (line.length > 2) {
log(line.substr(2));
}
});
socket.on("close", () => {
socket.destroy();
server.close();
this.emit('end');
callback();
});
});
server.listen(5000);
})
};
module.exports.log = log;