repo-util 1.18.0 → 1.19.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.
- package/package.json +6 -6
- package/src/repo-util-cli.mjs +77 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repo-util",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 2m tests/*.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"aggregation-repository-provider": "^5.2.
|
|
25
|
-
"bitbucket-repository-provider": "^4.1.
|
|
24
|
+
"aggregation-repository-provider": "^5.2.25",
|
|
25
|
+
"bitbucket-repository-provider": "^4.1.23",
|
|
26
26
|
"commander": "^9.2.0",
|
|
27
|
-
"gitea-repository-provider": "^2.1.
|
|
28
|
-
"github-repository-provider": "^7.
|
|
29
|
-
"local-repository-provider": "^8.0.
|
|
27
|
+
"gitea-repository-provider": "^2.1.55",
|
|
28
|
+
"github-repository-provider": "^7.29.1",
|
|
29
|
+
"local-repository-provider": "^8.0.10"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"ava": "^4.2.0",
|
package/src/repo-util-cli.mjs
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
import { readFileSync } from "fs";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
5
|
import { program, Option } from "commander";
|
|
6
|
+
import {
|
|
7
|
+
Repository,
|
|
8
|
+
RepositoryGroup,
|
|
9
|
+
Branch,
|
|
10
|
+
Tag,
|
|
11
|
+
Application,
|
|
12
|
+
Project,
|
|
13
|
+
Milestone,
|
|
14
|
+
Hook,
|
|
15
|
+
PullRequest,
|
|
16
|
+
MultiGroupProvider
|
|
17
|
+
} from "repository-provider";
|
|
6
18
|
import AggregationProvider from "aggregation-repository-provider";
|
|
7
19
|
|
|
8
20
|
process.on("uncaughtException", console.error);
|
|
@@ -26,90 +38,69 @@ program
|
|
|
26
38
|
);
|
|
27
39
|
|
|
28
40
|
for (const o of [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
update: {
|
|
35
|
-
description: "update provider attributes",
|
|
36
|
-
executeInstance: async provider => provider.update(properties)
|
|
37
|
-
}
|
|
41
|
+
type(MultiGroupProvider, {
|
|
42
|
+
update: {
|
|
43
|
+
description: "update provider attributes",
|
|
44
|
+
executeInstance: async provider => provider.update(properties)
|
|
38
45
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
executeInstance: async group => group.update(properties)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
[
|
|
49
|
-
"repository",
|
|
50
|
-
"repositories",
|
|
51
|
-
["fullName"],
|
|
52
|
-
{
|
|
53
|
-
update: {
|
|
54
|
-
description: "update repository attributes",
|
|
55
|
-
executeInstance: async repository => repository.update(properties)
|
|
56
|
-
},
|
|
57
|
-
create: {
|
|
58
|
-
suffix: "<names>",
|
|
59
|
-
description: "create repositories",
|
|
60
|
-
execute: async (provider, names, options) => {
|
|
61
|
-
for (const name of names) {
|
|
62
|
-
await provider.createRepository(name, properties);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
46
|
+
}),
|
|
47
|
+
type(RepositoryGroup, {
|
|
48
|
+
update: {
|
|
49
|
+
description: "update group attributes",
|
|
50
|
+
executeInstance: async group => group.update(properties)
|
|
66
51
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
description: "create a hook",
|
|
80
|
-
execute: () => {
|
|
81
|
-
console.log("create a hook");
|
|
52
|
+
}),
|
|
53
|
+
type(Repository, {
|
|
54
|
+
update: {
|
|
55
|
+
description: "update repository attributes",
|
|
56
|
+
executeInstance: async repository => repository.update(properties)
|
|
57
|
+
},
|
|
58
|
+
create: {
|
|
59
|
+
suffix: "<names>",
|
|
60
|
+
description: "create repositories",
|
|
61
|
+
execute: async (provider, names, options) => {
|
|
62
|
+
for (const name of names) {
|
|
63
|
+
await provider.createRepository(name, properties);
|
|
82
64
|
}
|
|
83
|
-
},
|
|
84
|
-
update: {
|
|
85
|
-
description: "update hook attributes",
|
|
86
|
-
executeInstance: hook => hook.update(properties)
|
|
87
|
-
},
|
|
88
|
-
delete: {
|
|
89
|
-
description: "delete a hook",
|
|
90
|
-
executeInstance: hook => hook.delete()
|
|
91
65
|
}
|
|
92
66
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
executeInstance: pr => pr.merge()
|
|
106
|
-
},
|
|
107
|
-
decline: {
|
|
108
|
-
description: "decline the pr",
|
|
109
|
-
executeInstance: pr => pr.decline()
|
|
67
|
+
}),
|
|
68
|
+
type(Branch),
|
|
69
|
+
type(Tag),
|
|
70
|
+
type(Project),
|
|
71
|
+
type(Milestone),
|
|
72
|
+
type(Application),
|
|
73
|
+
type(Hook, {
|
|
74
|
+
create: {
|
|
75
|
+
suffix: "<name>",
|
|
76
|
+
description: "create a hook",
|
|
77
|
+
execute: () => {
|
|
78
|
+
console.log("create a hook");
|
|
110
79
|
}
|
|
80
|
+
},
|
|
81
|
+
update: {
|
|
82
|
+
description: "update hook attributes",
|
|
83
|
+
executeInstance: hook => hook.update(properties)
|
|
84
|
+
},
|
|
85
|
+
delete: {
|
|
86
|
+
description: "delete a hook",
|
|
87
|
+
executeInstance: hook => hook.delete()
|
|
111
88
|
}
|
|
112
|
-
|
|
89
|
+
}),
|
|
90
|
+
type(PullRequest, {
|
|
91
|
+
update: {
|
|
92
|
+
description: "update pr attributes",
|
|
93
|
+
executeInstance: pr => pr.update(properties)
|
|
94
|
+
},
|
|
95
|
+
merge: {
|
|
96
|
+
description: "merge the pr",
|
|
97
|
+
executeInstance: pr => pr.merge()
|
|
98
|
+
},
|
|
99
|
+
decline: {
|
|
100
|
+
description: "decline the pr",
|
|
101
|
+
executeInstance: pr => pr.decline()
|
|
102
|
+
}
|
|
103
|
+
})
|
|
113
104
|
]) {
|
|
114
105
|
const command = program.command(`${o[0]} [name...]`);
|
|
115
106
|
command
|
|
@@ -234,3 +225,12 @@ function visibleAttributes(object) {
|
|
|
234
225
|
)
|
|
235
226
|
);
|
|
236
227
|
}
|
|
228
|
+
|
|
229
|
+
function type(clazz, extra) {
|
|
230
|
+
return [
|
|
231
|
+
clazz.type,
|
|
232
|
+
clazz.collectionName,
|
|
233
|
+
["fullName", ...Object.keys(visibleAttributes(clazz))],
|
|
234
|
+
extra
|
|
235
|
+
];
|
|
236
|
+
}
|