@datatruck/cli 0.29.0 → 0.29.1

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.
@@ -205,10 +205,10 @@ class BackupAction {
205
205
  keyIndex: pkg.name,
206
206
  data: { taskName: pkg.task.name, packageName: pkg.name },
207
207
  title: {
208
- initial: `Execute task: ${pkg.task?.name}`,
209
- started: `Executing task: ${pkg.task?.name}`,
210
- failed: `Task execute failed: ${pkg.task?.name}`,
211
- completed: `Task executed: ${pkg.task?.name}`,
208
+ initial: `Execute task: ${pkg.name} (${pkg.task.name})`,
209
+ started: `Executing task: ${pkg.name} (${pkg.task.name})`,
210
+ failed: `Task execute failed: ${pkg.name} (${pkg.task.name})`,
211
+ completed: `Task executed: ${pkg.name} (${pkg.task.name})`,
212
212
  },
213
213
  exitOnError: false,
214
214
  runWrapper: gc.cleanupIfFail.bind(gc),
@@ -228,10 +228,10 @@ class BackupAction {
228
228
  repositoryName: repositoryName,
229
229
  },
230
230
  title: {
231
- initial: `Create backup: ${repositoryName}`,
232
- started: `Creating backup: ${repositoryName}`,
233
- completed: `Backup created: ${repositoryName}`,
234
- failed: `Backup create failed: ${repositoryName}`,
231
+ initial: `Create backup: ${pkg.name} (${repositoryName})`,
232
+ started: `Creating backup: ${pkg.name} (${repositoryName})`,
233
+ completed: `Backup created: ${pkg.name} (${repositoryName})`,
234
+ failed: `Backup create failed: ${pkg.name} (${repositoryName})`,
235
235
  },
236
236
  exitOnError: false,
237
237
  runWrapper: gc.cleanupOnFinish.bind(gc),
@@ -271,10 +271,10 @@ class BackupAction {
271
271
  mirrorRepositoryName: mirror,
272
272
  },
273
273
  title: {
274
- initial: `Copy snapshot: ${mirror}`,
275
- started: `Copying snapshot: ${mirror}`,
276
- completed: `Snapshot copied: ${mirror}`,
277
- failed: `Snapshot copy failed: ${mirror}`,
274
+ initial: `Copy snapshot: ${pkg.name} (${mirror})`,
275
+ started: `Copying snapshot: ${pkg.name} (${mirror})`,
276
+ completed: `Snapshot copied: ${pkg.name} (${mirror})`,
277
+ failed: `Snapshot copy failed: ${pkg.name} (${mirror})`,
278
278
  },
279
279
  exitOnError: false,
280
280
  runWrapper: gc.cleanup.bind(gc),
@@ -179,10 +179,10 @@ class RestoreAction {
179
179
  keyIndex: snapshot.packageName,
180
180
  data: snapshot,
181
181
  title: {
182
- initial: `Restore ${snapshot.packageName} snapshot`,
183
- started: `Restoring ${snapshot.packageName} snapshot`,
184
- completed: `Snapshot restored: ${snapshot.packageName}`,
185
- failed: `Snapshot restore failed: ${snapshot.packageName}`,
182
+ initial: `Restore snapshot: ${snapshot.packageName} (${snapshot.repositoryName})`,
183
+ started: `Restoring snapshot: ${snapshot.packageName} (${snapshot.repositoryName})`,
184
+ completed: `Snapshot restored: ${snapshot.packageName} (${snapshot.repositoryName})`,
185
+ failed: `Snapshot restore failed: ${snapshot.packageName} (${snapshot.repositoryName})`,
186
186
  },
187
187
  exitOnError: false,
188
188
  run: async (listTask) => {
@@ -207,10 +207,10 @@ class RestoreAction {
207
207
  keyIndex: pkg.name,
208
208
  data: { taskName: pkg.task.name, packageName: pkg.name },
209
209
  title: {
210
- initial: `Execute ${pkg.task?.name} task`,
211
- started: `Executing ${pkg.task?.name} task`,
212
- completed: `Task executed: ${pkg.task?.name}`,
213
- failed: `Task execute failed: ${pkg.task?.name}`,
210
+ initial: `Execute task: ${pkg.name} (${pkg.task.name})`,
211
+ started: `Executing task: ${pkg.name} (${pkg.task.name})`,
212
+ completed: `Task executed: ${pkg.name} (${pkg.task.name})`,
213
+ failed: `Task execute failed: ${pkg.name} (${pkg.task.name})`,
214
214
  },
215
215
  exitOnError: false,
216
216
  runWrapper: gc.cleanup.bind(gc),
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @datatruck/cli
2
2
 
3
+ ## 0.29.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`34900c5`](https://github.com/swordev/datatruck/commit/34900c5ba9f323d491f2f6865c566386a4812c08) Thanks [@juanrgm](https://github.com/juanrgm)! - Fix texts
8
+
3
9
  ## 0.29.0
4
10
 
5
11
  ### Minor Changes
@@ -225,11 +225,11 @@ class DatatruckRepository extends RepositoryAbstract_1.RepositoryAbstract {
225
225
  output: tarPath,
226
226
  onEntry: async (data) => scanner.progress(pack.compress ? "Compressing" : "Packing", data.path),
227
227
  });
228
- scanner.progress("Fetching tar stats", (0, path_1.basename)(tarPath));
228
+ scanner.progress("Fetching tar stats", (0, path_1.basename)(tarPath), false);
229
229
  tarStats[packBasename].checksum = await (0, crypto_1.calcFileHash)(tarPath, "sha1");
230
230
  tarStats[packBasename].size = (await (0, promises_1.stat)(tarPath)).size;
231
231
  if (!fs.isLocal()) {
232
- scanner.progress("Uploading tar", (0, path_1.basename)(tarPath));
232
+ scanner.progress("Uploading tar", (0, path_1.basename)(tarPath), false);
233
233
  await fs.upload(tarPath, `${snapshotName}/${packBasename}`);
234
234
  await (0, promises_1.rm)(tarPath);
235
235
  }
@@ -117,7 +117,7 @@ class MysqlDumpTask extends TaskAbstract_1.TaskAbstract {
117
117
  items: [tableName],
118
118
  database: this.config.database,
119
119
  onSpawn: (p) => (controller.stop = () => p.kill()),
120
- ...(concurrency !== 1 && {
120
+ ...(concurrency === 1 && {
121
121
  onProgress(progress) {
122
122
  data.onProgress({
123
123
  relative: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datatruck/cli",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "dependencies": {
5
5
  "@supercharge/promise-pool": "^3.1.0",
6
6
  "ajv": "^8.12.0",
package/utils/fs.js CHANGED
@@ -384,7 +384,7 @@ function createProgress(options) {
384
384
  disposed: false,
385
385
  total: 0,
386
386
  current: 0,
387
- update: async (description, path, increment = true) => {
387
+ update: (description, path, increment = true) => {
388
388
  if (progress.disposed)
389
389
  return;
390
390
  if (path && increment)
package/utils/progress.js CHANGED
@@ -86,19 +86,26 @@ function renderProgressStats(stats, progressBar) {
86
86
  if (typeof stats.percent === "number") {
87
87
  if (progressBar)
88
88
  text.push((0, cli_1.renderProgressBar)(stats.percent));
89
- text.push(`${stats.percent.toFixed(2)}%`);
89
+ text.push(`${stats.percent.toFixed(2).padStart(5, " ")}%`);
90
90
  }
91
91
  if (typeof stats.current === "number" || typeof stats.total === "number") {
92
- const format = (value) => stats.format === "size" ? (0, bytes_1.default)(value) : value;
92
+ const format = (value) => stats.format === "size" ? (0, bytes_1.default)(value) : value.toString();
93
+ const pad = 8;
94
+ let values = [];
93
95
  if (typeof stats.current === "number" && typeof stats.total === "number") {
94
- text.push(`${format(stats.current)}/${format(stats.total)}`);
96
+ values = [
97
+ format(stats.current).padStart(pad, " "),
98
+ format(stats.total).padEnd(pad, " "),
99
+ ];
95
100
  }
96
101
  else if (typeof stats.current === "number") {
97
- text.push(`${format(stats.current)}`);
102
+ values = [format(stats.current).padStart(pad * 2 + 1)];
98
103
  }
99
104
  else if (typeof stats.total === "number") {
100
- text.push(`?/${format(stats.total)}`);
105
+ values = ["?".padStart(pad, " "), format(stats.total).padEnd(pad, " ")];
101
106
  }
107
+ if (values.length)
108
+ text.push(values.join("/"));
102
109
  }
103
110
  if (stats.description && stats.payload) {
104
111
  text.push(`${stats.description}: ${stats.payload}`);