@livingdata/pipex 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/reporter.js +23 -2
- package/package.json +1 -1
package/dist/cli/reporter.js
CHANGED
|
@@ -23,8 +23,10 @@ export class ConsoleReporter {
|
|
|
23
23
|
* Suitable for local development and manual execution.
|
|
24
24
|
*/
|
|
25
25
|
export class InteractiveReporter {
|
|
26
|
+
static maxStderrLines = 20;
|
|
26
27
|
spinner;
|
|
27
28
|
stepSpinners = new Map();
|
|
29
|
+
stderrBuffers = new Map();
|
|
28
30
|
state(workspaceId, event, step, meta) {
|
|
29
31
|
if (event === 'PIPELINE_START') {
|
|
30
32
|
const displayName = meta?.pipelineName ?? workspaceId;
|
|
@@ -50,6 +52,7 @@ export class InteractiveReporter {
|
|
|
50
52
|
spinner.stopAndPersist({ symbol: chalk.green('✓'), text: chalk.green(step.displayName) });
|
|
51
53
|
this.stepSpinners.delete(step.id);
|
|
52
54
|
}
|
|
55
|
+
this.stderrBuffers.delete(step.id);
|
|
53
56
|
}
|
|
54
57
|
if (event === 'STEP_FAILED' && step) {
|
|
55
58
|
const spinner = this.stepSpinners.get(step.id);
|
|
@@ -62,6 +65,14 @@ export class InteractiveReporter {
|
|
|
62
65
|
});
|
|
63
66
|
this.stepSpinners.delete(step.id);
|
|
64
67
|
}
|
|
68
|
+
const stderr = this.stderrBuffers.get(step.id);
|
|
69
|
+
if (stderr && stderr.length > 0) {
|
|
70
|
+
console.log(chalk.red(' ── stderr ──'));
|
|
71
|
+
for (const line of stderr) {
|
|
72
|
+
console.log(chalk.red(` ${line}`));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
this.stderrBuffers.delete(step.id);
|
|
65
76
|
}
|
|
66
77
|
if (event === 'PIPELINE_FINISHED') {
|
|
67
78
|
console.log(chalk.bold.green('\n✓ Pipeline completed\n'));
|
|
@@ -70,8 +81,18 @@ export class InteractiveReporter {
|
|
|
70
81
|
console.log(chalk.bold.red('\n✗ Pipeline failed\n'));
|
|
71
82
|
}
|
|
72
83
|
}
|
|
73
|
-
log(_workspaceId,
|
|
74
|
-
|
|
84
|
+
log(_workspaceId, step, stream, line) {
|
|
85
|
+
if (stream === 'stderr') {
|
|
86
|
+
let buffer = this.stderrBuffers.get(step.id);
|
|
87
|
+
if (!buffer) {
|
|
88
|
+
buffer = [];
|
|
89
|
+
this.stderrBuffers.set(step.id, buffer);
|
|
90
|
+
}
|
|
91
|
+
buffer.push(line);
|
|
92
|
+
if (buffer.length > InteractiveReporter.maxStderrLines) {
|
|
93
|
+
buffer.shift();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
75
96
|
}
|
|
76
97
|
result(_workspaceId, _step, _result) {
|
|
77
98
|
// Results shown via state updates
|