Skip to content

Commit 38d222c

Browse files
authored
Merge pull request #168 from fulldecent/copilot/fix-167
Replace cli-progress with direct line printing for progress reporting
2 parents b3438ff + 92a3130 commit 38d222c

File tree

3 files changed

+11
-37
lines changed

3 files changed

+11
-37
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"@shopify/prettier-plugin-liquid": "^1.9.3",
55
"better-sqlite3": "^12.2.0",
66
"cheerio": "^1.1.2",
7-
"cli-progress": "^3.12.0",
87
"css": "^3.0.0",
98
"glob": "^11.0.3",
109
"html-validate": "^10.0.0",

test/build-html-validate.mjs

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { glob } from "glob";
2-
import cliProgress from "cli-progress";
32
import { Worker } from "worker_threads";
43
import path from "path";
54
import { fileURLToPath } from "url";
@@ -28,21 +27,6 @@ console.log(`🧪 Validating ${targets.length} files with ${MAX_WORKERS} paralle
2827
await validateParallel();
2928

3029
async function validateParallel() {
31-
const multibar = new cliProgress.MultiBar(
32-
{
33-
format: "[{bar}] {percentage}% | {value}/{total} | {status}",
34-
hideCursor: true,
35-
clearOnComplete: false,
36-
stopOnComplete: true,
37-
forceRedraw: false,
38-
},
39-
cliProgress.Presets.shades_classic,
40-
);
41-
42-
const overallBar = multibar.create(targets.length, 0, {
43-
status: "Starting...",
44-
});
45-
4630
let completedTasks = 0;
4731
let allTestsPassed = true;
4832
const results = [];
@@ -54,7 +38,6 @@ async function validateParallel() {
5438
if (isDone) return;
5539
isDone = true;
5640

57-
multibar.stop();
5841
workers.forEach((worker) => worker.terminate());
5942

6043
const failedResults = results.filter((r) => !r.isValid);
@@ -65,9 +48,6 @@ async function validateParallel() {
6548

6649
if (failedResults.length > 0) {
6750
console.log(`❌ ${failedResults.length} files failed validation`);
68-
failedResults.forEach((result) => {
69-
console.log(`\n✅ File: ${path.relative(process.cwd(), result.filePath)}\n${result.message.trim()}`);
70-
});
7151
process.exit(1);
7252
} else {
7353
console.log("✨ All tests passed!\n");
@@ -81,15 +61,20 @@ async function validateParallel() {
8161
completedTasks++;
8262
results.push(result);
8363

64+
const relativeFilePath = path.relative(process.cwd(), result.filePath);
65+
8466
if (!result.isValid) {
8567
allTestsPassed = false;
86-
multibar.log(`❌ ${path.relative(process.cwd(), result.filePath)}\n${result.message.trim()}\n\n`);
68+
console.log(`❌ (${completedTasks} of ${targets.length}) ${relativeFilePath}`);
69+
// Print error messages with indentation
70+
const errorLines = result.message.trim().split("\n");
71+
errorLines.forEach((line) => {
72+
console.log(`- ${line}`);
73+
});
74+
} else {
75+
console.log(`✅ (${completedTasks} of ${targets.length}) ${relativeFilePath}`);
8776
}
8877

89-
overallBar.increment(1, {
90-
status: path.basename(result.filePath),
91-
});
92-
9378
if (taskQueue.length > 0) {
9479
const nextTask = taskQueue.shift();
9580
worker.postMessage({ filePath: nextTask, workerId });

yarn.lock

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -517,15 +517,6 @@ __metadata:
517517
languageName: node
518518
linkType: hard
519519

520-
"cli-progress@npm:^3.12.0":
521-
version: 3.12.0
522-
resolution: "cli-progress@npm:3.12.0"
523-
dependencies:
524-
string-width: "npm:^4.2.3"
525-
checksum: 10c0/f464cb19ebde2f3880620a2adfaeeefaec6cb15c8e610c8a659ca1047ee90d69f3bf2fdabbb1fe33ac408678e882e3e0eecdb84ab5df0edf930b269b8a72682d
526-
languageName: node
527-
linkType: hard
528-
529520
"cliui@npm:^5.0.0":
530521
version: 5.0.0
531522
resolution: "cliui@npm:5.0.0"
@@ -2640,7 +2631,6 @@ __metadata:
26402631
"@shopify/prettier-plugin-liquid": "npm:^1.9.3"
26412632
better-sqlite3: "npm:^12.2.0"
26422633
cheerio: "npm:^1.1.2"
2643-
cli-progress: "npm:^3.12.0"
26442634
css: "npm:^3.0.0"
26452635
front-matter: "npm:^4.0.2"
26462636
glob: "npm:^11.0.3"
@@ -2832,7 +2822,7 @@ __metadata:
28322822
languageName: node
28332823
linkType: hard
28342824

2835-
"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^4.1.0, string-width@npm:^4.2.3":
2825+
"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^4.1.0":
28362826
version: 4.2.3
28372827
resolution: "string-width@npm:4.2.3"
28382828
dependencies:

0 commit comments

Comments
 (0)