@forzalabs/remora 1.0.10 → 1.0.11

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.
@@ -76,7 +76,8 @@ class ExecutorOrchestratorClass {
76
76
  const firstLine = (yield DriverHelper_1.default.quickReadFile(response.files[0].fullUri, 1))[0];
77
77
  const header = ProducerExecutor_1.default.processHeader(firstLine, prod);
78
78
  const prodDimensions = ProducerExecutor_1.default.reconcileHeader(header, prod);
79
- for (const file of response.files) {
79
+ const totalFiles = response.files.length;
80
+ for (const [fileIndex, file] of response.files.entries()) {
80
81
  const chunks = ExecutorOrchestrator.scopeWork(file.fullUri);
81
82
  const workerThreads = [];
82
83
  for (const chunk of chunks) {
@@ -92,7 +93,7 @@ class ExecutorOrchestratorClass {
92
93
  workerId: workerId,
93
94
  options: options
94
95
  };
95
- _progress.register((currentWorkerIndex + 1).toString());
96
+ _progress.register((currentWorkerIndex + 1).toString(), prod.name, fileIndex, totalFiles);
96
97
  workersId.push(workerId);
97
98
  workerThreads.push(this._executorPool.exec('executor', [workerData], {
98
99
  on: payload => this.onWorkAdvanced(payload, currentWorkerIndex, _progress)
@@ -6,11 +6,12 @@ class ExecutorProgress {
6
6
  this._FPS = 2;
7
7
  this._lastRenderTime = 0;
8
8
  this._lastRenderedLines = -1;
9
- this.register = (name) => {
10
- this.workers[name] = 0;
9
+ this.register = (name, producerName, fileIndex, totalFiles) => {
10
+ this.workers[name] = { progress: 0, producerName, fileIndex, totalFiles };
11
11
  };
12
12
  this.update = (name, value) => {
13
- this.workers[name] = value;
13
+ if (this.workers[name])
14
+ this.workers[name].progress = value;
14
15
  const now = Date.now();
15
16
  const interval = 1000 / this._FPS;
16
17
  if (now - this._lastRenderTime >= interval) {
@@ -20,7 +21,7 @@ class ExecutorProgress {
20
21
  };
21
22
  this.complete = () => {
22
23
  for (const key of Object.keys(this.workers)) {
23
- this.workers[key] = 1;
24
+ this.workers[key].progress = 1;
24
25
  }
25
26
  this.render();
26
27
  };
@@ -35,13 +36,14 @@ class ExecutorProgress {
35
36
  }
36
37
  this._lastRenderedLines = 0;
37
38
  for (const key of Object.keys(this.workers)) {
38
- const wrk = this.workers[key] * 100;
39
- const percentage = Math.min(100, Math.max(0, wrk));
39
+ const worker = this.workers[key];
40
+ const percentage = Math.min(100, Math.max(0, worker.progress * 100));
40
41
  const barWidth = 30;
41
42
  const filledWidth = Math.floor((percentage / 100) * barWidth);
42
43
  const emptyWidth = barWidth - filledWidth;
43
44
  const bar = '#'.repeat(filledWidth) + '-'.repeat(emptyWidth);
44
- console.log(`Worker ${key.padStart(2, '0')}: [${bar}] ${percentage.toFixed(2)}%`);
45
+ const fileInfo = worker.totalFiles > 1 ? ` [${worker.fileIndex + 1}/${worker.totalFiles}]` : '';
46
+ console.log(`Worker ${key.padStart(2, '0')}: [${bar}] ${percentage.toFixed(2)}% (${worker.producerName}${fileInfo})`);
45
47
  this._lastRenderedLines++;
46
48
  }
47
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forzalabs/remora",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "A powerful CLI tool for seamless data translation.",
5
5
  "main": "index.js",
6
6
  "private": false,