@lde/pipeline-console-reporter 0.15.4 → 0.15.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.
@@ -9,6 +9,8 @@ export declare class ConsoleReporter implements ProgressReporter {
9
9
  private importSpinner?;
10
10
  private importTimer?;
11
11
  private probeLines;
12
+ /** Print a static succeed/fail line without starting a spinner animation. */
13
+ private printLine;
12
14
  pipelineStart(_name: string): void;
13
15
  datasetsSelected(count: number, duration: number): void;
14
16
  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;IACrD,OAAO,CAAC,UAAU,CAAuC;IAEzD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOlC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IASvD,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAepC,kBAAkB,CAAC,MAAM,EAAE,0BAA0B,GAAG,IAAI;IA2B5D,aAAa,IAAI,IAAI;IAYrB,YAAY,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAS9D,oBAAoB,C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AAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAc9D,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQlD,eAAe,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;IASxC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAIvD,gBAAgB,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAOrD"}
@@ -14,6 +14,10 @@ export class ConsoleReporter {
14
14
  importSpinner;
15
15
  importTimer;
16
16
  probeLines = [];
17
+ /** Print a static succeed/fail line without starting a spinner animation. */
18
+ printLine(method, text) {
19
+ ora({ discardStdin: false })[method](text);
20
+ }
17
21
  pipelineStart(_name) {
18
22
  this.stageSpinner = ora({
19
23
  discardStdin: false,
@@ -44,11 +48,10 @@ export class ConsoleReporter {
44
48
  : result.type === 'data-dump'
45
49
  ? 'Data dump'
46
50
  : 'Network error';
47
- const s = ora({ discardStdin: false });
48
51
  if (result.available) {
49
52
  const detail = result.statusCode !== undefined ? ` (HTTP ${result.statusCode})` : '';
50
53
  const text = `${typeLabel} ${url}${detail}`;
51
- s.succeed(text);
54
+ this.printLine('succeed', text);
52
55
  this.probeLines.push({ url, text });
53
56
  }
54
57
  else {
@@ -57,7 +60,7 @@ export class ConsoleReporter {
57
60
  : result.statusCode !== undefined
58
61
  ? ` (HTTP ${result.statusCode})`
59
62
  : '';
60
- s.fail(`${typeLabel} ${url}${detail}`);
63
+ this.printLine('fail', `${typeLabel} ${url}${detail}`);
61
64
  this.probeLines.push({ url, text: '' });
62
65
  }
63
66
  }
@@ -97,18 +100,19 @@ export class ConsoleReporter {
97
100
  const url = distribution.accessUrl.toString();
98
101
  const probe = this.probeLines.find((line) => line.url === url);
99
102
  const text = probe?.text || url;
103
+ const selectedText = `${text} ${chalk.green('(selected)')}`;
100
104
  if (probe?.text && process.stderr.isTTY) {
101
105
  const linesUp = this.probeLines.length - this.probeLines.indexOf(probe);
102
106
  // Move cursor up to the probe line and clear it.
103
107
  process.stderr.write(`\x1B[${linesUp}A\x1B[2K\r`);
104
- ora({ discardStdin: false }).succeed(`${text} ${chalk.green('(selected)')}`);
108
+ this.printLine('succeed', selectedText);
105
109
  // Move cursor back down to original position.
106
110
  if (linesUp > 1) {
107
111
  process.stderr.write(`\x1B[${linesUp - 1}B`);
108
112
  }
109
113
  }
110
114
  else {
111
- ora({ discardStdin: false }).succeed(`${text} ${chalk.green('(selected)')}`);
115
+ this.printLine('succeed', selectedText);
112
116
  }
113
117
  }
114
118
  }
@@ -145,12 +149,11 @@ export class ConsoleReporter {
145
149
  }
146
150
  }
147
151
  stageValidated(_stage, report) {
148
- const s = ora({ discardStdin: false });
149
152
  if (report.conforms) {
150
- s.succeed(`Validated ${compactNumber.format(report.quadsValidated)} quads`);
153
+ this.printLine('succeed', `Validated ${compactNumber.format(report.quadsValidated)} quads`);
151
154
  }
152
155
  else {
153
- s.fail(`Validated ${compactNumber.format(report.quadsValidated)} quads: ${chalk.red(`${compactNumber.format(report.violations)} violation(s)`)}`);
156
+ this.printLine('fail', `Validated ${compactNumber.format(report.quadsValidated)} quads: ${chalk.red(`${compactNumber.format(report.violations)} violation(s)`)}`);
154
157
  }
155
158
  }
156
159
  stageSkipped(_stage, reason) {
@@ -161,18 +164,10 @@ export class ConsoleReporter {
161
164
  }
162
165
  }
163
166
  datasetComplete(_dataset) {
164
- const s = ora({
165
- discardStdin: false,
166
- text: `Completed in ${chalk.bold(prettyMilliseconds(Date.now() - this.datasetStartTime))}`,
167
- });
168
- s.succeed();
167
+ this.printLine('succeed', `Completed in ${chalk.bold(prettyMilliseconds(Date.now() - this.datasetStartTime))}`);
169
168
  }
170
169
  datasetSkipped(_dataset, reason) {
171
- const s = ora({
172
- discardStdin: false,
173
- text: `Skipped: ${chalk.red(reason)}`,
174
- });
175
- s.fail();
170
+ this.printLine('fail', `Skipped: ${chalk.red(reason)}`);
176
171
  }
177
172
  pipelineComplete(result) {
178
173
  process.stderr.write(`\nPipeline completed in ${chalk.bold(prettyMilliseconds(result.duration))}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline-console-reporter",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "description": "Console progress reporter for @lde/pipeline",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -30,7 +30,7 @@
30
30
  "tslib": "^2.3.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@lde/dataset": "0.7.1",
34
- "@lde/pipeline": "0.24.2"
33
+ "@lde/dataset": "0.7.2",
34
+ "@lde/pipeline": "0.24.4"
35
35
  }
36
36
  }