Skip to content

Commit 9d581e7

Browse files
committed
fix(clearLine): use readline module
1 parent 17df727 commit 9d581e7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/index.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import del from 'del';
33
import fs from 'fs/promises';
44
import mkdirp from 'mkdirp';
55
import { join } from 'path';
6+
import readline from 'readline';
67

78
import { StatisticType } from './constants';
89
import { listFolder } from './lib/list-folder';
@@ -51,14 +52,14 @@ export const generate = async (argv: Record<string, string>) => {
5152
// print out all files
5253
for (const file of paths) {
5354
if (!file.isDir) {
54-
process.stdout.clearLine(-1);
55-
process.stdout.cursorTo(0);
55+
readline.clearLine(process.stdout, 0);
56+
readline.cursorTo(process.stdout, 0);
5657
process.stdout.write(`${chalk.dim(` ${file.path} `)}`);
5758
await new Promise(resolve => setTimeout(resolve, 20));
5859
}
5960
}
60-
process.stdout.clearLine(-1);
61-
process.stdout.cursorTo(0);
61+
readline.clearLine(process.stdout, 0);
62+
readline.cursorTo(process.stdout, 0);
6263

6364
// iterate through files and parse them
6465
for (const file of paths) {

0 commit comments

Comments
 (0)