@lde/pipeline-console-reporter 0.19.1 → 0.19.2

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.
@@ -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;AAgBvB,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,aAAa,CAAC,CAAM;IAC5B,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,WAAW,CAAC,CAAiC;IACrD,OAAO,CAAC,UAAU,CAAuC;IAEzD,gDAAgD;IAChD,OAAO,CAAC,SAAS;IAIjB,mDAAmD;IACnD,OAAO,CAAC,YAAY;IAOpB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIlC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IASvD,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAgBpC,kBAAkB,CAAC,MAAM,EAAE,0BAA0B,GAAG,IAAI;IA6B5D,aAAa,IAAI,IAAI;IAUrB,YAAY,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAY9D,oBAAoB,CAClB,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,YAAY,EAC1B,YAAY,CAAC,EAAE,YAAY,EAC3B,cAAc,CAAC,EAAE,MAAM,EACvB,WAAW,CAAC,EAAE,MAAM,GACnB,IAAI;IA0CP,OAAO,CAAC,gBAA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W,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAQ/C,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAgB9D,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQlD,eAAe,CACb,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAC1D,IAAI;IAUP,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAIvD,gBAAgB,CAAC,MAAM,EAAE;QACvB,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;QACzB,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,IAAI;CAOT"}
@@ -19,14 +19,18 @@ export class ConsoleReporter {
19
19
  importTimer;
20
20
  probeLines = [];
21
21
  /** Print a static line with a symbol prefix. */
22
- printLine(symbol, text) {
23
- process.stderr.write(`${symbol} ${text}\n`);
22
+ printLine(symbol, text, indent = 0) {
23
+ process.stderr.write(`${' '.repeat(indent)}${symbol} ${text}\n`);
24
24
  }
25
25
  /** Stop any active spinner and start a new one. */
26
- startSpinner(text) {
26
+ startSpinner(text, indent = 0) {
27
27
  this.activeSpinner?.stop();
28
28
  this.clearImportTimer();
29
- this.activeSpinner = ora({ discardStdin: false }).start(text);
29
+ const padding = ' '.repeat(indent);
30
+ this.activeSpinner = ora({
31
+ discardStdin: false,
32
+ prefixText: padding,
33
+ }).start(text);
30
34
  return this.activeSpinner;
31
35
  }
32
36
  pipelineStart(_name) {
@@ -60,10 +64,10 @@ export class ConsoleReporter {
60
64
  if (result.available) {
61
65
  const detail = result.statusCode !== undefined ? ` (HTTP ${result.statusCode})` : '';
62
66
  const text = `${typeLabel} ${url}${detail}`;
63
- this.printLine(logSymbols.success, text);
67
+ this.printLine(logSymbols.success, text, 1);
64
68
  this.probeLines.push({ url, text });
65
69
  for (const warning of result.warnings) {
66
- this.printLine(logSymbols.warning, warning);
70
+ this.printLine(logSymbols.warning, warning, 1);
67
71
  }
68
72
  }
69
73
  else {
@@ -72,13 +76,13 @@ export class ConsoleReporter {
72
76
  : result.statusCode !== undefined
73
77
  ? ` (HTTP ${result.statusCode})`
74
78
  : '';
75
- this.printLine(logSymbols.error, `${typeLabel} ${url}${detail}`);
79
+ this.printLine(logSymbols.error, `${typeLabel} ${url}${detail}`, 1);
76
80
  this.probeLines.push({ url, text: '' });
77
81
  }
78
82
  }
79
83
  importStarted() {
80
84
  const importStart = Date.now();
81
- const spinner = this.startSpinner('Importing\u2026');
85
+ const spinner = this.startSpinner('Importing\u2026', 1);
82
86
  this.importTimer = setInterval(() => {
83
87
  if (spinner.isSpinning) {
84
88
  spinner.suffixText = prettyMilliseconds(Date.now() - importStart);
@@ -92,7 +96,7 @@ export class ConsoleReporter {
92
96
  this.activeSpinner.fail();
93
97
  }
94
98
  else {
95
- this.printLine(logSymbols.error, `Import failed: ${error}`);
99
+ this.printLine(logSymbols.error, `Import failed: ${error}`, 1);
96
100
  }
97
101
  this.clearImportTimer();
98
102
  this.activeSpinner = undefined;
@@ -112,7 +116,7 @@ export class ConsoleReporter {
112
116
  this.activeSpinner.succeed();
113
117
  }
114
118
  else {
115
- this.printLine(logSymbols.success, text);
119
+ this.printLine(logSymbols.success, text, 1);
116
120
  }
117
121
  this.clearImportTimer();
118
122
  this.activeSpinner = undefined;
@@ -127,14 +131,14 @@ export class ConsoleReporter {
127
131
  const linesUp = this.probeLines.length - this.probeLines.indexOf(probe);
128
132
  // Move cursor up to the probe line and clear it.
129
133
  process.stderr.write(`\x1B[${linesUp}A\x1B[2K\r`);
130
- this.printLine(logSymbols.success, selectedText);
134
+ this.printLine(logSymbols.success, selectedText, 1);
131
135
  // Move cursor back down to original position.
132
136
  if (linesUp > 1) {
133
137
  process.stderr.write(`\x1B[${linesUp - 1}B`);
134
138
  }
135
139
  }
136
140
  else {
137
- this.printLine(logSymbols.success, selectedText);
141
+ this.printLine(logSymbols.success, selectedText, 1);
138
142
  }
139
143
  }
140
144
  }
@@ -146,7 +150,7 @@ export class ConsoleReporter {
146
150
  }
147
151
  stageStart(stage) {
148
152
  this.stageStartTime = Date.now();
149
- this.startSpinner(`Stage ${chalk.bold(stage)}`);
153
+ this.startSpinner(`Stage ${chalk.bold(stage)}`, 1);
150
154
  }
151
155
  stageProgress(update) {
152
156
  if (this.activeSpinner) {
@@ -170,10 +174,10 @@ export class ConsoleReporter {
170
174
  }
171
175
  stageValidated(_stage, report) {
172
176
  if (report.conforms) {
173
- this.printLine(logSymbols.success, `Validated ${compactNumber.format(report.quadsValidated)} quads`);
177
+ this.printLine(logSymbols.success, `Validated ${compactNumber.format(report.quadsValidated)} quads`, 2);
174
178
  }
175
179
  else {
176
- this.printLine(logSymbols.error, `Validated ${compactNumber.format(report.quadsValidated)} quads: ${chalk.red(`${compactNumber.format(report.violations)} violation(s)`)}`);
180
+ this.printLine(logSymbols.error, `Validated ${compactNumber.format(report.quadsValidated)} quads: ${chalk.red(`${compactNumber.format(report.violations)} violation(s)`)}`, 2);
177
181
  }
178
182
  }
179
183
  stageSkipped(_stage, reason) {
@@ -184,10 +188,10 @@ export class ConsoleReporter {
184
188
  }
185
189
  }
186
190
  datasetComplete(_dataset, result) {
187
- this.printLine(logSymbols.success, `Completed in ${chalk.bold(prettyMilliseconds(Date.now() - this.datasetStartTime))} ${chalk.dim(`(memory: ${formatBytes(result.memoryUsageBytes)} RSS, ${formatBytes(result.heapUsedBytes)} heap)`)}`);
191
+ this.printLine(logSymbols.success, `Completed in ${chalk.bold(prettyMilliseconds(Date.now() - this.datasetStartTime))} ${chalk.dim(`(memory: ${formatBytes(result.memoryUsageBytes)} RSS, ${formatBytes(result.heapUsedBytes)} heap)`)}`, 1);
188
192
  }
189
193
  datasetSkipped(_dataset, reason) {
190
- this.printLine(logSymbols.error, `Skipped: ${chalk.red(reason)}`);
194
+ this.printLine(logSymbols.error, `Skipped: ${chalk.red(reason)}`, 1);
191
195
  }
192
196
  pipelineComplete(result) {
193
197
  process.stderr.write(`\nPipeline completed in ${chalk.bold(prettyMilliseconds(result.duration))} ${chalk.dim(`(memory: ${formatBytes(result.memoryUsageBytes)} RSS, ${formatBytes(result.heapUsedBytes)} heap)`)}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline-console-reporter",
3
- "version": "0.19.1",
3
+ "version": "0.19.2",
4
4
  "description": "Console progress reporter for @lde/pipeline",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",