diff --git a/demo/app.js b/demo/app.js index e36652b..95babc5 100644 --- a/demo/app.js +++ b/demo/app.js @@ -20,7 +20,7 @@ demo1.job('pull', ci.shell(function () { demo1.job('build', ci.by(['pull'], ci.shell(function () { /* - npm i + nokit xxx npm test */ }))); diff --git a/package.json b/package.json index 412dbf2..68a5fad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cize", - "version": "0.0.25", + "version": "0.0.26", "dbVersion": "1", "description": "Cize 是一个「持续集成」工具", "main": "index.js", @@ -26,6 +26,7 @@ }, "license": "MIT", "dependencies": { + "ansi-to-html": "^0.4.1", "async": "^1.5.2", "bootstrap": "^3.3.6", "cify": "^1.0.0", @@ -45,8 +46,7 @@ "request": "^2.72.0", "rmdir": "^1.2.0", "shify": "^0.1.0", - "sqlite3": "^3.1.4", - "xterm": "^0.33.0" + "sqlite3": "^3.1.4" }, "devDependencies": { "istanbul": "^0.4.3", diff --git a/web/config.json b/web/config.json index fcf5ac9..f719ee8 100644 --- a/web/config.json +++ b/web/config.json @@ -28,8 +28,7 @@ "^/bootstrap(.*)": "../node_modules/bootstrap/dist", "^/jquery(.*)": "../node_modules/jquery/dist", "^/font-awesome(.*)": "../node_modules/font-awesome", - "^/pjax/(.*)$": "../node_modules/nokit-pjax/client", - "^/xterm/(.*)$": "../node_modules/xterm/src" + "^/pjax/(.*)$": "../node_modules/nokit-pjax/client" } }, "session": { diff --git a/web/controllers/main.js b/web/controllers/main.js index 3001b21..c5b7a06 100644 --- a/web/controllers/main.js +++ b/web/controllers/main.js @@ -1,7 +1,11 @@ const async = require('async'); const fs = require('fs'); const path = require('path'); - +const Convert = require('ansi-to-html'); +const convert = new Convert({ + fg: '#333', + bg: '#fff' +}); /** * 定义 MainController **/ @@ -111,7 +115,7 @@ const MainController = nokit.define({ } fs.readFile(outFile, function (err, data) { if (err) return callback(err); - self.record.out = data.toString(); + self.record.out = convert.toHtml(data.toString().replace(/\[2K\[0G/igm, '')); callback(); }); }); diff --git a/web/public/js/main.js b/web/public/js/main.js index c3d05bb..26732a8 100644 --- a/web/public/js/main.js +++ b/web/public/js/main.js @@ -20,8 +20,8 @@ } var url = location.href.split('?')[0]; $.get(url + '/console?_t=' + Date.now(), function (data) { - if (console.text() != data) { - console.text(data); + if (console.html() != data) { + console.html(data); console.prop('scrollTop', console.prop('scrollHeight')); } return fetchOut(SHORT_INTERVAL);