@datatruck/cli 0.36.8 → 0.38.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.
- package/config.schema.json +168 -108
- package/lib/actions/BackupAction.d.ts +61 -20
- package/lib/actions/BackupAction.js +43 -17
- package/lib/actions/CleanCacheAction.d.ts +6 -7
- package/lib/actions/CleanCacheAction.js +2 -1
- package/lib/actions/ConfigAction.d.ts +3 -5
- package/lib/actions/ConfigAction.js +0 -1
- package/lib/actions/CopyAction.d.ts +43 -12
- package/lib/actions/CopyAction.js +31 -4
- package/lib/actions/ExportAction.d.ts +94 -0
- package/lib/actions/ExportAction.js +236 -0
- package/lib/actions/InitAction.d.ts +17 -7
- package/lib/actions/InitAction.js +9 -1
- package/lib/actions/PruneAction.d.ts +76 -17
- package/lib/actions/PruneAction.js +62 -2
- package/lib/actions/RestoreAction.d.ts +61 -22
- package/lib/actions/RestoreAction.js +46 -58
- package/lib/actions/SnapshotsAction.d.ts +80 -21
- package/lib/actions/SnapshotsAction.js +82 -1
- package/lib/cli.d.ts +0 -3
- package/lib/cli.js +31 -56
- package/lib/commands/BackupCommand.d.ts +121 -13
- package/lib/commands/BackupCommand.js +29 -54
- package/lib/commands/CleanCacheCommand.d.ts +10 -3
- package/lib/commands/CleanCacheCommand.js +14 -6
- package/lib/commands/CommandAbstract.d.ts +11 -10
- package/lib/commands/CommandAbstract.js +6 -9
- package/lib/commands/ConfigCommand.d.ts +72 -9
- package/lib/commands/ConfigCommand.js +36 -28
- package/lib/commands/CopyCommand.d.ts +103 -10
- package/lib/commands/CopyCommand.js +25 -44
- package/lib/commands/ExportCommand.d.ts +143 -0
- package/lib/commands/ExportCommand.js +50 -0
- package/lib/commands/InitCommand.d.ts +43 -7
- package/lib/commands/InitCommand.js +22 -19
- package/lib/commands/PruneCommand.d.ts +237 -17
- package/lib/commands/PruneCommand.js +27 -99
- package/lib/commands/RestoreCommand.d.ts +127 -13
- package/lib/commands/RestoreCommand.js +27 -53
- package/lib/commands/RunCommand.d.ts +29 -0
- package/lib/commands/RunCommand.js +44 -0
- package/lib/commands/SnapshotsCommand.d.ts +240 -23
- package/lib/commands/SnapshotsCommand.js +23 -101
- package/lib/commands/StartServerCommand.d.ts +10 -3
- package/lib/commands/StartServerCommand.js +23 -15
- package/lib/repositories/DatatruckRepository.js +1 -1
- package/lib/tasks/MssqlTask.js +1 -1
- package/lib/tasks/MysqlDumpTask.js +1 -1
- package/lib/tasks/SqlDumpTaskAbstract.js +2 -2
- package/lib/utils/cli.d.ts +1 -18
- package/lib/utils/cli.js +9 -49
- package/lib/utils/datatruck/command.d.ts +8 -5
- package/lib/utils/datatruck/command.js +8 -4
- package/lib/utils/datatruck/config-type.d.ts +4 -0
- package/lib/utils/datatruck/cron-server.d.ts +8 -39
- package/lib/utils/datatruck/cron-server.js +35 -57
- package/lib/utils/datatruck/job.d.ts +41 -0
- package/lib/utils/datatruck/job.js +82 -0
- package/lib/utils/datatruck/report-list.js +1 -1
- package/lib/utils/datatruck/repository.d.ts +1 -0
- package/lib/utils/datatruck/repository.js +8 -1
- package/lib/utils/list.d.ts +5 -0
- package/lib/utils/list.js +9 -0
- package/lib/utils/math.js +1 -1
- package/lib/utils/object.d.ts +5 -0
- package/lib/utils/object.js +10 -1
- package/lib/utils/options.d.ts +24 -0
- package/lib/utils/options.js +94 -0
- package/lib/utils/progress.js +1 -1
- package/lib/utils/restic.js +1 -1
- package/lib/utils/string.d.ts +2 -1
- package/lib/utils/string.js +5 -1
- package/lib/utils/watcher.js +1 -1
- package/package.json +4 -4
|
@@ -1,43 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigCommand = void 0;
|
|
3
|
+
exports.ConfigCommand = exports.configCommandOptions = void 0;
|
|
4
4
|
const ConfigAction_1 = require("../actions/ConfigAction");
|
|
5
5
|
const data_format_1 = require("../utils/data-format");
|
|
6
6
|
const config_1 = require("../utils/datatruck/config");
|
|
7
7
|
const string_1 = require("../utils/string");
|
|
8
8
|
const CommandAbstract_1 = require("./CommandAbstract");
|
|
9
|
+
exports.configCommandOptions = {
|
|
10
|
+
packageNames: {
|
|
11
|
+
description: "Filter by package names",
|
|
12
|
+
shortFlag: "p",
|
|
13
|
+
value: "array",
|
|
14
|
+
},
|
|
15
|
+
packageTaskNames: {
|
|
16
|
+
description: "Filter by package task names",
|
|
17
|
+
shortFlag: "pt",
|
|
18
|
+
value: "array",
|
|
19
|
+
},
|
|
20
|
+
repositoryNames: {
|
|
21
|
+
description: "Filter by repository names",
|
|
22
|
+
shortFlag: "r",
|
|
23
|
+
value: "array",
|
|
24
|
+
},
|
|
25
|
+
repositoryTypes: {
|
|
26
|
+
description: "Filter by repository types",
|
|
27
|
+
shortFlag: "rt",
|
|
28
|
+
value: (string_1.parseStringList),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
9
31
|
class ConfigCommand extends CommandAbstract_1.CommandAbstract {
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
option: "-pt,--package-task <values>",
|
|
20
|
-
parser: string_1.parseStringList,
|
|
21
|
-
},
|
|
22
|
-
repository: {
|
|
23
|
-
description: "Filter by repository names",
|
|
24
|
-
option: "-r,--repository <values>",
|
|
25
|
-
parser: string_1.parseStringList,
|
|
26
|
-
},
|
|
27
|
-
repositoryType: {
|
|
28
|
-
description: "Filter by repository types",
|
|
29
|
-
option: "-rt,--repository-type <values>",
|
|
30
|
-
parser: (v) => (0, string_1.parseStringList)(v),
|
|
31
|
-
},
|
|
32
|
-
});
|
|
32
|
+
static config() {
|
|
33
|
+
return {
|
|
34
|
+
name: "config",
|
|
35
|
+
alias: "c",
|
|
36
|
+
options: exports.configCommandOptions,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
get optionsConfig() {
|
|
40
|
+
return exports.configCommandOptions;
|
|
33
41
|
}
|
|
34
42
|
async exec() {
|
|
35
43
|
const result = await ConfigAction_1.ConfigAction.fromGlobalOptionsWithPath(this.globalOptions);
|
|
36
44
|
const packages = (0, config_1.filterPackages)(result.data, {
|
|
37
|
-
packageNames: this.options.
|
|
38
|
-
packageTaskNames: this.options.
|
|
39
|
-
repositoryNames: this.options.
|
|
40
|
-
repositoryTypes: this.options.
|
|
45
|
+
packageNames: this.options.packageNames,
|
|
46
|
+
packageTaskNames: this.options.packageTaskNames,
|
|
47
|
+
repositoryNames: this.options.repositoryNames,
|
|
48
|
+
repositoryTypes: this.options.repositoryTypes,
|
|
41
49
|
});
|
|
42
50
|
const summaryConfig = packages.flatMap((pkg) => ({
|
|
43
51
|
packageName: pkg.name,
|
|
@@ -1,17 +1,110 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InferOptions } from "../utils/options";
|
|
2
2
|
import { CommandAbstract } from "./CommandAbstract";
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
export declare const copyCommandOptions: {
|
|
4
|
+
repositoryNames2: {
|
|
5
|
+
description: string;
|
|
6
|
+
shortFlag: string;
|
|
7
|
+
value: "array";
|
|
8
|
+
};
|
|
9
|
+
packageNames: {
|
|
10
|
+
description: string;
|
|
11
|
+
shortFlag: string;
|
|
12
|
+
value: "array";
|
|
13
|
+
};
|
|
14
|
+
packageTaskNames: {
|
|
15
|
+
description: string;
|
|
16
|
+
shortFlag: string;
|
|
17
|
+
value: "array";
|
|
18
|
+
};
|
|
19
|
+
ids: {
|
|
20
|
+
description: string;
|
|
21
|
+
shortFlag: string;
|
|
22
|
+
value: "array";
|
|
23
|
+
};
|
|
24
|
+
last: {
|
|
25
|
+
description: string;
|
|
26
|
+
shortFlag: string;
|
|
27
|
+
value: "number";
|
|
28
|
+
};
|
|
29
|
+
repositoryName: {
|
|
30
|
+
description: string;
|
|
31
|
+
shortFlag: string;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
10
34
|
};
|
|
11
|
-
export
|
|
12
|
-
|
|
35
|
+
export type CopyCommandOptions = InferOptions<typeof copyCommandOptions>;
|
|
36
|
+
export declare class CopyCommand extends CommandAbstract<typeof copyCommandOptions> {
|
|
37
|
+
static config(): {
|
|
38
|
+
name: string;
|
|
39
|
+
alias: string;
|
|
40
|
+
options: {
|
|
41
|
+
repositoryNames2: {
|
|
42
|
+
description: string;
|
|
43
|
+
shortFlag: string;
|
|
44
|
+
value: "array";
|
|
45
|
+
};
|
|
46
|
+
packageNames: {
|
|
47
|
+
description: string;
|
|
48
|
+
shortFlag: string;
|
|
49
|
+
value: "array";
|
|
50
|
+
};
|
|
51
|
+
packageTaskNames: {
|
|
52
|
+
description: string;
|
|
53
|
+
shortFlag: string;
|
|
54
|
+
value: "array";
|
|
55
|
+
};
|
|
56
|
+
ids: {
|
|
57
|
+
description: string;
|
|
58
|
+
shortFlag: string;
|
|
59
|
+
value: "array";
|
|
60
|
+
};
|
|
61
|
+
last: {
|
|
62
|
+
description: string;
|
|
63
|
+
shortFlag: string;
|
|
64
|
+
value: "number";
|
|
65
|
+
};
|
|
66
|
+
repositoryName: {
|
|
67
|
+
description: string;
|
|
68
|
+
shortFlag: string;
|
|
69
|
+
required: true;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
get optionsConfig(): {
|
|
74
|
+
repositoryNames2: {
|
|
75
|
+
description: string;
|
|
76
|
+
shortFlag: string;
|
|
77
|
+
value: "array";
|
|
78
|
+
};
|
|
79
|
+
packageNames: {
|
|
80
|
+
description: string;
|
|
81
|
+
shortFlag: string;
|
|
82
|
+
value: "array";
|
|
83
|
+
};
|
|
84
|
+
packageTaskNames: {
|
|
85
|
+
description: string;
|
|
86
|
+
shortFlag: string;
|
|
87
|
+
value: "array";
|
|
88
|
+
};
|
|
89
|
+
ids: {
|
|
90
|
+
description: string;
|
|
91
|
+
shortFlag: string;
|
|
92
|
+
value: "array";
|
|
93
|
+
};
|
|
94
|
+
last: {
|
|
95
|
+
description: string;
|
|
96
|
+
shortFlag: string;
|
|
97
|
+
value: "number";
|
|
98
|
+
};
|
|
99
|
+
repositoryName: {
|
|
100
|
+
description: string;
|
|
101
|
+
shortFlag: string;
|
|
102
|
+
required: true;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
13
105
|
exec(): Promise<{
|
|
14
106
|
result: (import("../utils/list").List3SummaryResult | import("../utils/list").Listr3TaskResult<import("../actions/CopyAction").Context>)[];
|
|
15
107
|
exitCode: number;
|
|
108
|
+
errors: Error[];
|
|
16
109
|
}>;
|
|
17
110
|
}
|
|
@@ -1,66 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CopyCommand = void 0;
|
|
3
|
+
exports.CopyCommand = exports.copyCommandOptions = void 0;
|
|
4
4
|
const ConfigAction_1 = require("../actions/ConfigAction");
|
|
5
5
|
const CopyAction_1 = require("../actions/CopyAction");
|
|
6
|
-
const string_1 = require("../utils/string");
|
|
7
6
|
const CommandAbstract_1 = require("./CommandAbstract");
|
|
7
|
+
exports.copyCommandOptions = {
|
|
8
|
+
...CopyAction_1.copyActionOptions,
|
|
9
|
+
};
|
|
8
10
|
class CopyCommand extends CommandAbstract_1.CommandAbstract {
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
description: "Last snapshots",
|
|
19
|
-
parser: Number,
|
|
20
|
-
},
|
|
21
|
-
package: {
|
|
22
|
-
option: "-p,--package <names>",
|
|
23
|
-
description: "Filter by package names",
|
|
24
|
-
parser: string_1.parseStringList,
|
|
25
|
-
},
|
|
26
|
-
packageTask: {
|
|
27
|
-
option: "-pt,--package-task <values>",
|
|
28
|
-
description: "Filter by task names",
|
|
29
|
-
parser: string_1.parseStringList,
|
|
30
|
-
},
|
|
31
|
-
repository: {
|
|
32
|
-
option: "-r,--repository <name>",
|
|
33
|
-
description: "Filter by repository name",
|
|
34
|
-
required: true,
|
|
35
|
-
},
|
|
36
|
-
repository2: {
|
|
37
|
-
option: "-r2,--repository2 <names>",
|
|
38
|
-
description: "Filter by repository names",
|
|
39
|
-
parser: string_1.parseStringList,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
11
|
+
static config() {
|
|
12
|
+
return {
|
|
13
|
+
name: "copy",
|
|
14
|
+
alias: "cp",
|
|
15
|
+
options: exports.copyCommandOptions,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
get optionsConfig() {
|
|
19
|
+
return exports.copyCommandOptions;
|
|
42
20
|
}
|
|
43
21
|
async exec() {
|
|
44
22
|
const verbose = this.globalOptions.verbose ?? 0;
|
|
45
23
|
const config = await ConfigAction_1.ConfigAction.fromGlobalOptions(this.globalOptions);
|
|
46
24
|
const copy = new CopyAction_1.CopyAction(config, {
|
|
47
|
-
ids: this.options.
|
|
25
|
+
ids: this.options.ids,
|
|
48
26
|
last: this.options.last,
|
|
49
|
-
packageNames: this.options.
|
|
50
|
-
packageTaskNames: this.options.
|
|
51
|
-
repositoryName: this.options.
|
|
52
|
-
repositoryNames2: this.options.
|
|
27
|
+
packageNames: this.options.packageNames,
|
|
28
|
+
packageTaskNames: this.options.packageTaskNames,
|
|
29
|
+
repositoryName: this.options.repositoryName,
|
|
30
|
+
repositoryNames2: this.options.repositoryNames2,
|
|
53
31
|
verbose: verbose > 0,
|
|
54
32
|
tty: this.globalOptions.tty,
|
|
55
33
|
progress: this.globalOptions.progress,
|
|
56
34
|
});
|
|
57
|
-
const
|
|
35
|
+
const data = await copy.exec();
|
|
58
36
|
if (this.globalOptions.outputFormat)
|
|
59
37
|
copy
|
|
60
|
-
.dataFormat(result, {
|
|
38
|
+
.dataFormat(data.result, {
|
|
39
|
+
verbose,
|
|
40
|
+
streams: this.streams,
|
|
41
|
+
errors: data.errors,
|
|
42
|
+
})
|
|
61
43
|
.log(this.globalOptions.outputFormat);
|
|
62
|
-
|
|
63
|
-
return { result, exitCode };
|
|
44
|
+
return data;
|
|
64
45
|
}
|
|
65
46
|
}
|
|
66
47
|
exports.CopyCommand = CopyCommand;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { InferOptions } from "../utils/options";
|
|
2
|
+
import { CommandAbstract } from "./CommandAbstract";
|
|
3
|
+
export declare const exportCommandOptions: {
|
|
4
|
+
repositoryNames: {
|
|
5
|
+
description: string;
|
|
6
|
+
shortFlag: string;
|
|
7
|
+
value: "array";
|
|
8
|
+
};
|
|
9
|
+
repositoryTypes: {
|
|
10
|
+
description: string;
|
|
11
|
+
shortFlag: string;
|
|
12
|
+
value: "array";
|
|
13
|
+
};
|
|
14
|
+
packageNames: {
|
|
15
|
+
description: string;
|
|
16
|
+
shortFlag: string;
|
|
17
|
+
value: "array";
|
|
18
|
+
};
|
|
19
|
+
packageTaskNames: {
|
|
20
|
+
description: string;
|
|
21
|
+
shortFlag: string;
|
|
22
|
+
value: "array";
|
|
23
|
+
};
|
|
24
|
+
tags: {
|
|
25
|
+
description: string;
|
|
26
|
+
shortFlag: string;
|
|
27
|
+
value: "array";
|
|
28
|
+
};
|
|
29
|
+
packageConfig: {
|
|
30
|
+
description: string;
|
|
31
|
+
shortFlag: string;
|
|
32
|
+
};
|
|
33
|
+
id: {
|
|
34
|
+
description: string;
|
|
35
|
+
shortFlag: string;
|
|
36
|
+
required: true;
|
|
37
|
+
};
|
|
38
|
+
outPath: {
|
|
39
|
+
description: string;
|
|
40
|
+
required: true;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export type ExportCommandOptions = InferOptions<typeof exportCommandOptions>;
|
|
44
|
+
export declare class ExportCommand extends CommandAbstract<typeof exportCommandOptions> {
|
|
45
|
+
static config(): {
|
|
46
|
+
name: string;
|
|
47
|
+
options: {
|
|
48
|
+
repositoryNames: {
|
|
49
|
+
description: string;
|
|
50
|
+
shortFlag: string;
|
|
51
|
+
value: "array";
|
|
52
|
+
};
|
|
53
|
+
repositoryTypes: {
|
|
54
|
+
description: string;
|
|
55
|
+
shortFlag: string;
|
|
56
|
+
value: "array";
|
|
57
|
+
};
|
|
58
|
+
packageNames: {
|
|
59
|
+
description: string;
|
|
60
|
+
shortFlag: string;
|
|
61
|
+
value: "array";
|
|
62
|
+
};
|
|
63
|
+
packageTaskNames: {
|
|
64
|
+
description: string;
|
|
65
|
+
shortFlag: string;
|
|
66
|
+
value: "array";
|
|
67
|
+
};
|
|
68
|
+
tags: {
|
|
69
|
+
description: string;
|
|
70
|
+
shortFlag: string;
|
|
71
|
+
value: "array";
|
|
72
|
+
};
|
|
73
|
+
packageConfig: {
|
|
74
|
+
description: string;
|
|
75
|
+
shortFlag: string;
|
|
76
|
+
};
|
|
77
|
+
id: {
|
|
78
|
+
description: string;
|
|
79
|
+
shortFlag: string;
|
|
80
|
+
required: true;
|
|
81
|
+
};
|
|
82
|
+
outPath: {
|
|
83
|
+
description: string;
|
|
84
|
+
required: true;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
get optionsConfig(): {
|
|
89
|
+
repositoryNames: {
|
|
90
|
+
description: string;
|
|
91
|
+
shortFlag: string;
|
|
92
|
+
value: "array";
|
|
93
|
+
};
|
|
94
|
+
repositoryTypes: {
|
|
95
|
+
description: string;
|
|
96
|
+
shortFlag: string;
|
|
97
|
+
value: "array";
|
|
98
|
+
};
|
|
99
|
+
packageNames: {
|
|
100
|
+
description: string;
|
|
101
|
+
shortFlag: string;
|
|
102
|
+
value: "array";
|
|
103
|
+
};
|
|
104
|
+
packageTaskNames: {
|
|
105
|
+
description: string;
|
|
106
|
+
shortFlag: string;
|
|
107
|
+
value: "array";
|
|
108
|
+
};
|
|
109
|
+
tags: {
|
|
110
|
+
description: string;
|
|
111
|
+
shortFlag: string;
|
|
112
|
+
value: "array";
|
|
113
|
+
};
|
|
114
|
+
packageConfig: {
|
|
115
|
+
description: string;
|
|
116
|
+
shortFlag: string;
|
|
117
|
+
};
|
|
118
|
+
id: {
|
|
119
|
+
description: string;
|
|
120
|
+
shortFlag: string;
|
|
121
|
+
required: true;
|
|
122
|
+
};
|
|
123
|
+
outPath: {
|
|
124
|
+
description: string;
|
|
125
|
+
required: true;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
exec(): Promise<{
|
|
129
|
+
result: (import("../utils/list").List3SummaryResult | import("../utils/list").Listr3TaskResult<{
|
|
130
|
+
snapshots: {
|
|
131
|
+
id: string;
|
|
132
|
+
packages: number;
|
|
133
|
+
};
|
|
134
|
+
task: {
|
|
135
|
+
taskName: string;
|
|
136
|
+
packageName: string;
|
|
137
|
+
};
|
|
138
|
+
export: import("../actions/SnapshotsAction").ExtendedSnapshot;
|
|
139
|
+
}>)[];
|
|
140
|
+
exitCode: number;
|
|
141
|
+
errors: Error[];
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportCommand = exports.exportCommandOptions = void 0;
|
|
4
|
+
const ConfigAction_1 = require("../actions/ConfigAction");
|
|
5
|
+
const ExportAction_1 = require("../actions/ExportAction");
|
|
6
|
+
const CommandAbstract_1 = require("./CommandAbstract");
|
|
7
|
+
exports.exportCommandOptions = {
|
|
8
|
+
...ExportAction_1.exportActionOptions,
|
|
9
|
+
};
|
|
10
|
+
class ExportCommand extends CommandAbstract_1.CommandAbstract {
|
|
11
|
+
static config() {
|
|
12
|
+
return {
|
|
13
|
+
name: "export",
|
|
14
|
+
options: exports.exportCommandOptions,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
get optionsConfig() {
|
|
18
|
+
return exports.exportCommandOptions;
|
|
19
|
+
}
|
|
20
|
+
async exec() {
|
|
21
|
+
const verbose = this.globalOptions.verbose ?? 0;
|
|
22
|
+
const config = await ConfigAction_1.ConfigAction.fromGlobalOptions(this.globalOptions);
|
|
23
|
+
const restore = new ExportAction_1.ExportAction(config, {
|
|
24
|
+
id: this.options.id,
|
|
25
|
+
packageNames: this.options.packageNames,
|
|
26
|
+
packageTaskNames: this.options.packageTaskNames,
|
|
27
|
+
packageConfig: this.options.packageConfig,
|
|
28
|
+
repositoryNames: this.options.repositoryNames,
|
|
29
|
+
repositoryTypes: this.options.repositoryTypes,
|
|
30
|
+
tags: this.options.tags,
|
|
31
|
+
outPath: this.options.outPath,
|
|
32
|
+
verbose: verbose > 0,
|
|
33
|
+
}, {
|
|
34
|
+
tty: this.globalOptions.tty,
|
|
35
|
+
progress: this.globalOptions.progress,
|
|
36
|
+
streams: this.streams,
|
|
37
|
+
});
|
|
38
|
+
const data = await restore.exec();
|
|
39
|
+
if (this.globalOptions.outputFormat)
|
|
40
|
+
restore
|
|
41
|
+
.dataFormat(data.result, {
|
|
42
|
+
verbose,
|
|
43
|
+
streams: this.streams,
|
|
44
|
+
errors: data.errors,
|
|
45
|
+
})
|
|
46
|
+
.log(this.globalOptions.outputFormat);
|
|
47
|
+
return data;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ExportCommand = ExportCommand;
|
|
@@ -1,12 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { If } from "../utils/ts";
|
|
1
|
+
import { InferOptions } from "../utils/options";
|
|
3
2
|
import { CommandAbstract } from "./CommandAbstract";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare const initCommandOptions: {
|
|
4
|
+
repositoryNames: {
|
|
5
|
+
description: string;
|
|
6
|
+
shortFlag: string;
|
|
7
|
+
value: "array";
|
|
8
|
+
};
|
|
9
|
+
repositoryTypes: {
|
|
10
|
+
description: string;
|
|
11
|
+
shortFlag: string;
|
|
12
|
+
value: "array";
|
|
13
|
+
};
|
|
7
14
|
};
|
|
8
|
-
export
|
|
9
|
-
|
|
15
|
+
export type InitCommandOptions = InferOptions<typeof initCommandOptions>;
|
|
16
|
+
export declare class InitCommand extends CommandAbstract<typeof initCommandOptions> {
|
|
17
|
+
static config(): {
|
|
18
|
+
name: string;
|
|
19
|
+
alias: string;
|
|
20
|
+
options: {
|
|
21
|
+
repositoryNames: {
|
|
22
|
+
description: string;
|
|
23
|
+
shortFlag: string;
|
|
24
|
+
value: "array";
|
|
25
|
+
};
|
|
26
|
+
repositoryTypes: {
|
|
27
|
+
description: string;
|
|
28
|
+
shortFlag: string;
|
|
29
|
+
value: "array";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
get optionsConfig(): {
|
|
34
|
+
repositoryNames: {
|
|
35
|
+
description: string;
|
|
36
|
+
shortFlag: string;
|
|
37
|
+
value: "array";
|
|
38
|
+
};
|
|
39
|
+
repositoryTypes: {
|
|
40
|
+
description: string;
|
|
41
|
+
shortFlag: string;
|
|
42
|
+
value: "array";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
10
45
|
exec(): Promise<{
|
|
11
46
|
result: {
|
|
12
47
|
repositoryName: string;
|
|
@@ -15,5 +50,6 @@ export declare class InitCommand extends CommandAbstract<InitCommandOptions<fals
|
|
|
15
50
|
error: Error | null;
|
|
16
51
|
}[];
|
|
17
52
|
exitCode: number;
|
|
53
|
+
errors: Error[];
|
|
18
54
|
}>;
|
|
19
55
|
}
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InitCommand = void 0;
|
|
3
|
+
exports.InitCommand = exports.initCommandOptions = void 0;
|
|
4
4
|
const ConfigAction_1 = require("../actions/ConfigAction");
|
|
5
5
|
const InitAction_1 = require("../actions/InitAction");
|
|
6
6
|
const cli_1 = require("../utils/cli");
|
|
7
7
|
const data_format_1 = require("../utils/data-format");
|
|
8
|
-
const
|
|
8
|
+
const error_1 = require("../utils/error");
|
|
9
9
|
const CommandAbstract_1 = require("./CommandAbstract");
|
|
10
|
+
exports.initCommandOptions = {
|
|
11
|
+
...InitAction_1.initActionOptions,
|
|
12
|
+
};
|
|
10
13
|
class InitCommand extends CommandAbstract_1.CommandAbstract {
|
|
11
|
-
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
option: "-rt,--repository-type <values>",
|
|
21
|
-
parser: (v) => (0, string_1.parseStringList)(v),
|
|
22
|
-
},
|
|
23
|
-
});
|
|
14
|
+
static config() {
|
|
15
|
+
return {
|
|
16
|
+
name: "init",
|
|
17
|
+
alias: "i",
|
|
18
|
+
options: exports.initCommandOptions,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
get optionsConfig() {
|
|
22
|
+
return exports.initCommandOptions;
|
|
24
23
|
}
|
|
25
24
|
async exec() {
|
|
26
25
|
const verbose = this.globalOptions.verbose ?? 0;
|
|
27
26
|
const config = await ConfigAction_1.ConfigAction.fromGlobalOptions(this.globalOptions);
|
|
28
27
|
const init = new InitAction_1.InitAction(config, {
|
|
29
|
-
repositoryNames: this.options.
|
|
30
|
-
repositoryTypes: this.options.
|
|
28
|
+
repositoryNames: this.options.repositoryNames,
|
|
29
|
+
repositoryTypes: this.options.repositoryTypes,
|
|
31
30
|
verbose: verbose > 0,
|
|
32
31
|
});
|
|
33
32
|
const result = await init.exec();
|
|
33
|
+
const exitCode = result.some((item) => item.error) ? 1 : 0;
|
|
34
|
+
const errors = result
|
|
35
|
+
.filter((item) => item.error && (verbose || !(item.error instanceof error_1.AppError)))
|
|
36
|
+
.map(({ error }) => error);
|
|
34
37
|
const dataFormat = new data_format_1.DataFormat({
|
|
35
38
|
streams: this.streams,
|
|
36
39
|
json: result,
|
|
@@ -47,13 +50,13 @@ class InitCommand extends CommandAbstract_1.CommandAbstract {
|
|
|
47
50
|
item.repositoryName,
|
|
48
51
|
item.repositoryType,
|
|
49
52
|
item.repositorySource,
|
|
50
|
-
(0, cli_1.renderError)(item.error,
|
|
53
|
+
(0, cli_1.renderError)(item.error, errors.indexOf(item.error)),
|
|
51
54
|
]),
|
|
52
55
|
},
|
|
53
56
|
});
|
|
54
57
|
if (this.globalOptions.outputFormat)
|
|
55
58
|
dataFormat.log(this.globalOptions.outputFormat);
|
|
56
|
-
return { result, exitCode
|
|
59
|
+
return { result, exitCode, errors };
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
exports.InitCommand = InitCommand;
|