repo-util 1.27.2 → 1.27.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.
- package/package.json +2 -2
- package/src/repo-util-cli.mjs +30 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repo-util",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"bitbucket-repository-provider": "^5.0.7",
|
|
26
26
|
"commander": "^10.0.1",
|
|
27
27
|
"etag-cache-leveldb": "^2.0.1",
|
|
28
|
-
"gitea-repository-provider": "^3.0.
|
|
28
|
+
"gitea-repository-provider": "^3.0.6",
|
|
29
29
|
"github-repository-provider": "^8.0.11",
|
|
30
30
|
"leveldown": "^6.1.1",
|
|
31
31
|
"levelup": "^5.1.1"
|
package/src/repo-util-cli.mjs
CHANGED
|
@@ -42,10 +42,8 @@ program
|
|
|
42
42
|
const { provider, cache } = await initializeRepositoryProvider(program);
|
|
43
43
|
|
|
44
44
|
for (const t of [
|
|
45
|
-
type(MultiGroupProvider
|
|
46
|
-
|
|
47
|
-
type(Repository, {
|
|
48
|
-
create: {
|
|
45
|
+
type(MultiGroupProvider, {
|
|
46
|
+
"create-repository": {
|
|
49
47
|
suffix: "<names>",
|
|
50
48
|
description: "create repositories",
|
|
51
49
|
execute: async (provider, names, options) => {
|
|
@@ -53,23 +51,37 @@ for (const t of [
|
|
|
53
51
|
await provider.createRepository(name, properties);
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
type(RepositoryGroup),
|
|
57
|
+
type(Repository, {
|
|
58
|
+
"add-hook": {
|
|
58
59
|
suffix: "<names>",
|
|
59
|
-
description: "add a
|
|
60
|
+
description: "add a hook",
|
|
61
|
+
prepareCommand(command) {
|
|
62
|
+
command.option("-u, --url <url>", "hook url to be called")
|
|
63
|
+
},
|
|
60
64
|
executeInstance: async (repository, options) => {
|
|
65
|
+
console.log("ADD HOOK");
|
|
66
|
+
console.log(options);
|
|
61
67
|
const hook = new repository.hookClass(repository, "hook1", {
|
|
62
|
-
id: 77,
|
|
63
68
|
url: "http://somewere.com/path",
|
|
64
69
|
events: new Set(["a"])
|
|
65
70
|
});
|
|
66
|
-
|
|
71
|
+
|
|
67
72
|
console.log(hook);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
|
-
|
|
71
75
|
}),
|
|
72
|
-
type(Branch
|
|
76
|
+
type(Branch, {
|
|
77
|
+
"create-pull-request": {
|
|
78
|
+
suffix: "<name>",
|
|
79
|
+
description: "create a pull-request from a branch",
|
|
80
|
+
execute: () => {
|
|
81
|
+
console.log("create a PR");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}),
|
|
73
85
|
type(Tag),
|
|
74
86
|
type(Project),
|
|
75
87
|
type(Milestone),
|
|
@@ -81,13 +93,6 @@ for (const t of [
|
|
|
81
93
|
}
|
|
82
94
|
}),
|
|
83
95
|
type(PullRequest, {
|
|
84
|
-
create: {
|
|
85
|
-
suffix: "<name>",
|
|
86
|
-
description: "create a PR",
|
|
87
|
-
execute: () => {
|
|
88
|
-
console.log("create a PR");
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
96
|
merge: {
|
|
92
97
|
description: "merge the pr",
|
|
93
98
|
executeInstance: pr => pr.merge()
|
|
@@ -98,7 +103,7 @@ for (const t of [
|
|
|
98
103
|
}
|
|
99
104
|
})
|
|
100
105
|
]) {
|
|
101
|
-
const command = program.command(`${t.name} [name...]`);
|
|
106
|
+
const command = program.command(`${t.name} [name...]` /*,`list ${t.name}`*/);
|
|
102
107
|
|
|
103
108
|
const actions = t.actions;
|
|
104
109
|
|
|
@@ -108,13 +113,15 @@ for (const t of [
|
|
|
108
113
|
for (const [an, actionOptions] of Object.entries(actions)) {
|
|
109
114
|
if (actionOptions.execute) {
|
|
110
115
|
const command = program.command(
|
|
111
|
-
`${t.name}-${an} ${actionOptions.suffix}
|
|
116
|
+
`${t.name}-${an} ${actionOptions.suffix}`,
|
|
117
|
+
actionOptions.description
|
|
118
|
+
);
|
|
119
|
+
command.action(async (names, options) =>
|
|
120
|
+
actionOptions.execute(provider, names, options)
|
|
112
121
|
);
|
|
113
|
-
command.action(async (names, options) => {
|
|
114
|
-
await actionOptions.execute(provider, names, options);
|
|
115
|
-
});
|
|
116
122
|
}
|
|
117
123
|
if (actionOptions.executeInstance) {
|
|
124
|
+
actionOptions.prepareCommand?.(command);
|
|
118
125
|
command.option(
|
|
119
126
|
`--${an}`,
|
|
120
127
|
actionOptions.description,
|