komatsu
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -52,3 +52,6 @@ const logUpdate = require('./log-update') | ||
if (data.status && previous.status !== data.status) { | ||
if ( | ||
(data.status && previous.status !== data.status) || | ||
previous.message.length > data.message.length | ||
) { | ||
logUpdate.clear() | ||
@@ -55,0 +58,0 @@ } |
@@ -5,2 +5,3 @@ // originally https://github.com/sindresorhus/log-update/ | ||
const cliCursor = require('cli-cursor') | ||
const stripAnsi = require('@quarterto/strip-ansi') | ||
@@ -56,6 +57,10 @@ const moveLines = count => { | ||
const width = getWidth(stream) | ||
prevLineCount = out | ||
prevLineCount = stripAnsi(out) | ||
.split('\n') | ||
.map(line => 1 + Math.floor(line.length / width)) | ||
.map(line => Math.floor(line.length / width) + 1) | ||
.reduce((a, b) => a + b) | ||
// stream.write(prevLineCount.toString()) | ||
// console.log(out, `\n------ ${prevLineCount}`) | ||
} | ||
@@ -62,0 +67,0 @@ |
{ | ||
"name": "komatsu", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "", | ||
@@ -47,2 +47,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"@quarterto/strip-ansi": "^1.1.0", | ||
"ansi-colors": "^3.2.4", | ||
@@ -49,0 +50,0 @@ "ansi-escapes": "^4.2.0", |
@@ -5,7 +5,18 @@ const Komatsu = require('./') | ||
Array.from({ length: 50 }, (_, i) => { | ||
logger.log(i, { message: `stress test ${i}` }) | ||
logger.log(i, { | ||
message: `stress test ${i} ${'a'.repeat(Math.ceil(100 * Math.random()))}`, | ||
}) | ||
setTimeout( | ||
() => logger.log(i, { status: 'done', message: `stress test ${i}` }), | ||
() => | ||
logger.log(i, { | ||
message: `stress test ${i} ${'a'.repeat( | ||
Math.ceil(100 * Math.random()), | ||
)}`, | ||
}), | ||
Math.random() * 5000, | ||
) | ||
setTimeout( | ||
() => logger.log(i, { status: 'done', message: `stress test ${i}` }), | ||
Math.random() * 5000 + 5000, | ||
) | ||
}) |
360659
9
234
5
+ Added@quarterto/strip-ansi@^1.1.0
+ Added@quarterto/strip-ansi@1.2.0(transitive)