@lde/pipeline-console-reporter 0.14.0 → 0.15.0
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.
|
@@ -8,6 +8,7 @@ export declare class ConsoleReporter implements ProgressReporter {
|
|
|
8
8
|
private datasetIndex;
|
|
9
9
|
private importSpinner?;
|
|
10
10
|
private importTimer?;
|
|
11
|
+
private probeLines;
|
|
11
12
|
pipelineStart(_name: string): void;
|
|
12
13
|
datasetsSelected(count: number, duration: number): void;
|
|
13
14
|
datasetStart(dataset: Dataset): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consoleReporter.d.ts","sourceRoot":"","sources":["../src/consoleReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAUvB,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,YAAY,CAAC,CAAM;IAC3B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,aAAa,CAAC,CAAM;IAC5B,OAAO,CAAC,WAAW,CAAC,CAAiC;
|
|
1
|
+
{"version":3,"file":"consoleReporter.d.ts","sourceRoot":"","sources":["../src/consoleReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAUvB,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,YAAY,CAAC,CAAM;IAC3B,OAAO,CAAC,cAAc,CAAK;I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AAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQlD,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IAUxC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQvD,gBAAgB,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAOrD"}
|
package/dist/consoleReporter.js
CHANGED
|
@@ -13,6 +13,7 @@ export class ConsoleReporter {
|
|
|
13
13
|
datasetIndex = 0;
|
|
14
14
|
importSpinner;
|
|
15
15
|
importTimer;
|
|
16
|
+
probeLines = [];
|
|
16
17
|
pipelineStart(_name) {
|
|
17
18
|
this.stageSpinner = ora({
|
|
18
19
|
discardStdin: false,
|
|
@@ -29,6 +30,7 @@ export class ConsoleReporter {
|
|
|
29
30
|
this.stageSpinner?.succeed();
|
|
30
31
|
this.stageSpinner = undefined;
|
|
31
32
|
this.datasetStartTime = Date.now();
|
|
33
|
+
this.probeLines = [];
|
|
32
34
|
this.datasetIndex++;
|
|
33
35
|
const counter = this.datasetTotal > 1
|
|
34
36
|
? ` ${chalk.dim(`[${this.datasetIndex}/${this.datasetTotal}]`)}`
|
|
@@ -46,7 +48,9 @@ export class ConsoleReporter {
|
|
|
46
48
|
const s = ora({ discardStdin: false });
|
|
47
49
|
if (result.available) {
|
|
48
50
|
const detail = result.statusCode !== undefined ? ` (HTTP ${result.statusCode})` : '';
|
|
49
|
-
|
|
51
|
+
const text = `${typeLabel} ${url}${detail}`;
|
|
52
|
+
s.succeed(text);
|
|
53
|
+
this.probeLines.push({ url, text });
|
|
50
54
|
}
|
|
51
55
|
else {
|
|
52
56
|
const detail = result.error
|
|
@@ -55,6 +59,7 @@ export class ConsoleReporter {
|
|
|
55
59
|
? ` (HTTP ${result.statusCode})`
|
|
56
60
|
: '';
|
|
57
61
|
s.fail(`${typeLabel} ${url}${detail}`);
|
|
62
|
+
this.probeLines.push({ url, text: '' });
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
importStarted() {
|
|
@@ -90,8 +95,23 @@ export class ConsoleReporter {
|
|
|
90
95
|
this.clearImportSpinner();
|
|
91
96
|
}
|
|
92
97
|
else {
|
|
93
|
-
const
|
|
94
|
-
|
|
98
|
+
const url = distribution.accessUrl.toString();
|
|
99
|
+
const index = this.probeLines.findIndex((line) => line.url === url);
|
|
100
|
+
if (index !== -1 && this.probeLines[index].text) {
|
|
101
|
+
const linesUp = this.probeLines.length - index;
|
|
102
|
+
const probe = this.probeLines[index];
|
|
103
|
+
// Move cursor up to the probe line and clear it.
|
|
104
|
+
process.stderr.write(`\x1B[${linesUp}A\x1B[2K\r`);
|
|
105
|
+
// Rewrite the probe line with "(selected)" appended.
|
|
106
|
+
ora({ discardStdin: false }).succeed(`${probe.text} ${chalk.green('(selected)')}`);
|
|
107
|
+
// Move cursor back down to original position.
|
|
108
|
+
if (linesUp > 1) {
|
|
109
|
+
process.stderr.write(`\x1B[${linesUp - 1}B`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
ora({ discardStdin: false }).succeed(`${url} ${chalk.green('(selected)')}`);
|
|
114
|
+
}
|
|
95
115
|
}
|
|
96
116
|
}
|
|
97
117
|
clearImportSpinner() {
|