0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[windows:ci] handle CLI output in a cross-compat way (#2801)

* handle readline in a cross-compat way

* Create modern-feet-lay.md
This commit is contained in:
Fred K. Schott 2022-03-15 10:30:25 -07:00 committed by GitHub
parent fc50fbb47a
commit 11fb3745dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Fix: Handle CLI output in a cross-compat way

View file

@ -4,6 +4,7 @@ import { bold, cyan, dim, red, grey, underline, yellow, reset } from 'kleur/colo
import { performance } from 'perf_hooks';
import { Writable } from 'stream';
import stringWidth from 'string-width';
import * as readline from 'readline';
import debugPackage from 'debug';
import { format as utilFormat } from 'util';
@ -69,9 +70,9 @@ export const defaultLogDestination = new Writable({
lines = Math.ceil(len / cols);
}
for (let i = 0; i < lines; i++) {
(dest as typeof process.stdout).clearLine(0);
(dest as typeof process.stdout).cursorTo(0);
(dest as typeof process.stdout).moveCursor(0, -1);
readline.clearLine(dest, 0);
readline.cursorTo(dest, 0);
readline.moveCursor(dest, 0, -1);
}
}
message = `${message} ${yellow(`(x${lastMessageCount})`)}`;