@lde/pipeline-console-reporter 0.8.0 → 0.10.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.
@@ -6,12 +6,16 @@ export declare class ConsoleReporter implements ProgressReporter {
6
6
  private datasetStartTime;
7
7
  private datasetTotal;
8
8
  private datasetIndex;
9
+ private importSpinner?;
10
+ private importTimer?;
9
11
  pipelineStart(_name: string): void;
10
12
  datasetsSelected(count: number, duration: number): void;
11
13
  datasetStart(dataset: Dataset): void;
12
14
  distributionProbed(result: DistributionAnalysisResult): void;
15
+ importStarted(): void;
13
16
  importFailed(_distribution: Distribution, error: string): void;
14
17
  distributionSelected(_dataset: Dataset, distribution: Distribution, importedFrom?: Distribution, importDuration?: number, tripleCount?: number): void;
18
+ private clearImportSpinner;
15
19
  stageStart(stage: string): void;
16
20
  stageProgress(update: {
17
21
  itemsProcessed: number;
@@ -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,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;IAEzB,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;IAapC,kBAAkB,CAAC,MAAM,EAAE,0BAA0B,GAAG,IAAI;IA0B5D,YAAY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Q,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAQvD,gBAAgB,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAOrD"}
@@ -11,6 +11,8 @@ export class ConsoleReporter {
11
11
  datasetStartTime = 0;
12
12
  datasetTotal = 0;
13
13
  datasetIndex = 0;
14
+ importSpinner;
15
+ importTimer;
14
16
  pipelineStart(_name) {
15
17
  this.stageSpinner = ora({
16
18
  discardStdin: false,
@@ -57,26 +59,50 @@ export class ConsoleReporter {
57
59
  s.fail();
58
60
  }
59
61
  }
62
+ importStarted() {
63
+ const importStart = Date.now();
64
+ this.importSpinner = ora({ discardStdin: false }).start('Importing\u2026');
65
+ this.importTimer = setInterval(() => {
66
+ if (this.importSpinner) {
67
+ this.importSpinner.suffixText = prettyMilliseconds(Date.now() - importStart);
68
+ }
69
+ }, 1_000);
70
+ }
60
71
  importFailed(_distribution, error) {
61
- const s = ora({ discardStdin: false });
62
- s.start(`Import failed: ${error}`);
63
- s.fail();
72
+ const spinner = this.importSpinner ?? ora({ discardStdin: false });
73
+ if (!this.importSpinner)
74
+ spinner.start();
75
+ spinner.text = `Import failed: ${error}`;
76
+ spinner.suffixText = '';
77
+ spinner.fail();
78
+ this.clearImportSpinner();
64
79
  }
65
80
  distributionSelected(_dataset, distribution, importedFrom, importDuration, tripleCount) {
66
- const s = ora({ discardStdin: false });
67
81
  if (importedFrom) {
82
+ const spinner = this.importSpinner ?? ora({ discardStdin: false }).start();
68
83
  const count = tripleCount !== undefined
69
84
  ? `${compactNumber.format(tripleCount)} triples, `
70
85
  : '';
71
86
  const duration = importDuration !== undefined
72
87
  ? ` in ${chalk.bold(prettyMilliseconds(importDuration))}`
73
88
  : '';
74
- s.start(`Imported ${importedFrom.accessUrl.toString()} (${count}to ${distribution.accessUrl.toString()})${duration}`);
89
+ spinner.text = `Imported ${importedFrom.accessUrl.toString()} (${count}to ${distribution.accessUrl.toString()})${duration}`;
90
+ spinner.suffixText = '';
91
+ spinner.succeed();
92
+ this.clearImportSpinner();
75
93
  }
76
94
  else {
95
+ const s = ora({ discardStdin: false });
77
96
  s.start(`${distribution.accessUrl.toString()} ${chalk.dim('(selected)')}`);
97
+ s.succeed();
78
98
  }
79
- s.succeed();
99
+ }
100
+ clearImportSpinner() {
101
+ if (this.importTimer) {
102
+ clearInterval(this.importTimer);
103
+ this.importTimer = undefined;
104
+ }
105
+ this.importSpinner = undefined;
80
106
  }
81
107
  stageStart(stage) {
82
108
  this.stageStartTime = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lde/pipeline-console-reporter",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "Console progress reporter for @lde/pipeline",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/ldelements/lde.git",
@@ -24,11 +24,13 @@
24
24
  "!**/*.tsbuildinfo"
25
25
  ],
26
26
  "dependencies": {
27
- "@lde/dataset": "0.7.1",
28
- "@lde/pipeline": "0.19.0",
29
27
  "chalk": "^5.4.1",
30
28
  "ora": "^9.3.0",
31
29
  "pretty-ms": "^9.3.0",
32
30
  "tslib": "^2.3.0"
31
+ },
32
+ "peerDependencies": {
33
+ "@lde/dataset": "0.7.1",
34
+ "@lde/pipeline": "0.21.0"
33
35
  }
34
36
  }