@datatruck/cli 0.23.1 → 0.23.3

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.
@@ -20,7 +20,7 @@ export type DatatruckRepositoryConfigType = {
20
20
  type PackObject = {
21
21
  name?: string;
22
22
  compress?: boolean | CompressOptions;
23
- include: string[];
23
+ include?: string[];
24
24
  exclude?: string[];
25
25
  onePackByResult?: boolean;
26
26
  };
@@ -37,7 +37,6 @@ exports.datatruckPackageRepositoryDefinition = {
37
37
  items: {
38
38
  type: "object",
39
39
  additionalProperties: false,
40
- required: ["include"],
41
40
  properties: {
42
41
  name: { type: "string" },
43
42
  compress: {
@@ -184,18 +183,16 @@ class DatatruckRepository extends RepositoryAbstract_1.RepositoryAbstract {
184
183
  const defaultsPack = {
185
184
  name: "defaults",
186
185
  compress: data.packageConfig?.compress ?? this.config.compress,
187
- include: [],
188
186
  };
189
- const packs = [...configPacks, defaultsPack];
187
+ const packs = [defaultsPack, ...configPacks];
190
188
  const defaultsPackIndex = packs.findIndex((p) => p === defaultsPack);
191
189
  const stream = (0, fs_1.createWriteStreamPool)({
192
190
  path: await this.mkTmpDir("files"),
193
191
  onStreamPath: (key) => `files-${key}.txt`,
194
192
  });
193
+ scanner.total++;
194
+ stream.writeLine(defaultsPackIndex, ".");
195
195
  await scanner.start(async (entry) => {
196
- if (entry.dirent.isDirectory() &&
197
- !(await (0, fs_1.isEmptyDir)((0, path_1.join)(sourcePath, entry.path))))
198
- return false;
199
196
  let packIndex = configPacks.findIndex((pack) => (0, string_1.match)(entry.path, pack.include, pack.exclude));
200
197
  if (packIndex === -1)
201
198
  packIndex = defaultsPackIndex;
@@ -208,6 +205,10 @@ class DatatruckRepository extends RepositoryAbstract_1.RepositoryAbstract {
208
205
  });
209
206
  packIndex = packs.length - 1;
210
207
  }
208
+ if (!stream.lines(packIndex)) {
209
+ scanner.total++;
210
+ stream.writeLine(packIndex, ".");
211
+ }
211
212
  stream.writeLine(packIndex, entry.path);
212
213
  return true;
213
214
  });
@@ -31,6 +31,7 @@ class MysqlDumpTask extends TaskAbstract_1.TaskAbstract {
31
31
  async onBackup(data) {
32
32
  const sql = await (0, mysql_1.createMysqlCli)({
33
33
  ...this.config,
34
+ database: undefined,
34
35
  verbose: data.options.verbose,
35
36
  });
36
37
  const tableNames = await sql.fetchTableNames(this.config.database, this.config.includeTables, this.config.excludeTables);
@@ -147,6 +148,7 @@ class MysqlDumpTask extends TaskAbstract_1.TaskAbstract {
147
148
  async onRestore(data) {
148
149
  const sql = await (0, mysql_1.createMysqlCli)({
149
150
  ...this.config,
151
+ database: undefined,
150
152
  verbose: data.options.verbose,
151
153
  });
152
154
  const restorePath = data.package.restorePath;
@@ -479,9 +479,6 @@
479
479
  "items": {
480
480
  "type": "object",
481
481
  "additionalProperties": false,
482
- "required": [
483
- "include"
484
- ],
485
482
  "properties": {
486
483
  "name": {
487
484
  "type": "string"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datatruck/cli",
3
- "version": "0.23.1",
3
+ "version": "0.23.3",
4
4
  "dependencies": {
5
5
  "@supercharge/promise-pool": "^3.1.0",
6
6
  "ajv": "^8.12.0",
package/utils/cli.js CHANGED
@@ -21,6 +21,8 @@ function renderSpinner(counter) {
21
21
  }
22
22
  exports.renderSpinner = renderSpinner;
23
23
  function renderProgressBar(progress, size = 10, subprogress) {
24
+ if (progress > 100)
25
+ throw new Error(`Invalid progress value: ${progress}`);
24
26
  const completeChar = "\u2588";
25
27
  const incompleteChar = "\u2591";
26
28
  const completedSize = Math.round((progress * size) / 100);
package/utils/tar.js CHANGED
@@ -104,6 +104,7 @@ async function createTar(options) {
104
104
  }),
105
105
  };
106
106
  await (0, process_1.exec)("tar", [
107
+ "--no-recursion",
107
108
  "-C",
108
109
  toLocalPath(options.path),
109
110
  compress?.cores === 1 ? "-czvf" : "-cvf",