Skip to content

Commit

Permalink
fix(clearLine): use readline module
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Sep 2, 2021
1 parent 17df727 commit 9d581e7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import del from 'del';
import fs from 'fs/promises';
import mkdirp from 'mkdirp';
import { join } from 'path';
import readline from 'readline';

import { StatisticType } from './constants';
import { listFolder } from './lib/list-folder';
Expand Down Expand Up @@ -51,14 +52,14 @@ export const generate = async (argv: Record<string, string>) => {
// print out all files
for (const file of paths) {
if (!file.isDir) {
process.stdout.clearLine(-1);
process.stdout.cursorTo(0);
readline.clearLine(process.stdout, 0);
readline.cursorTo(process.stdout, 0);
process.stdout.write(`${chalk.dim(` ${file.path} `)}`);
await new Promise(resolve => setTimeout(resolve, 20));
}
}
process.stdout.clearLine(-1);
process.stdout.cursorTo(0);
readline.clearLine(process.stdout, 0);
readline.cursorTo(process.stdout, 0);

// iterate through files and parse them
for (const file of paths) {
Expand Down

0 comments on commit 9d581e7

Please sign in to comment.