repo-util 1.24.74 → 1.24.76
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 +20 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repo-util",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.76",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 2m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"aggregation-repository-provider": "^5.3.
|
|
25
|
-
"bitbucket-repository-provider": "^4.4.
|
|
24
|
+
"aggregation-repository-provider": "^5.3.20",
|
|
25
|
+
"bitbucket-repository-provider": "^4.4.29",
|
|
26
26
|
"commander": "^9.4.1",
|
|
27
27
|
"etag-cache-leveldb": "^1.4.1",
|
|
28
|
-
"gitea-repository-provider": "^2.4.
|
|
29
|
-
"github-repository-provider": "^7.33.
|
|
28
|
+
"gitea-repository-provider": "^2.4.31",
|
|
29
|
+
"github-repository-provider": "^7.33.31",
|
|
30
30
|
"leveldown": "^6.1.1",
|
|
31
31
|
"levelup": "^5.1.1",
|
|
32
|
-
"local-repository-provider": "^8.1.
|
|
32
|
+
"local-repository-provider": "^8.1.9",
|
|
33
33
|
"node-fetch": "^3.3.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/src/repo-util-cli.mjs
CHANGED
|
@@ -14,9 +14,13 @@ import {
|
|
|
14
14
|
MultiGroupProvider
|
|
15
15
|
} from "repository-provider";
|
|
16
16
|
import pkg from "../package.json" assert { type: "json" };
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
initializeRepositoryProvider,
|
|
19
|
+
initializeCommandLine
|
|
20
|
+
} from "./setup-provider.mjs";
|
|
18
21
|
|
|
19
22
|
const properties = {};
|
|
23
|
+
let action;
|
|
20
24
|
|
|
21
25
|
initializeCommandLine(program);
|
|
22
26
|
|
|
@@ -85,14 +89,7 @@ for (const t of [
|
|
|
85
89
|
|
|
86
90
|
const actions = t.actions;
|
|
87
91
|
|
|
88
|
-
command.action(async (names, options) =>
|
|
89
|
-
list(
|
|
90
|
-
provider,
|
|
91
|
-
names,
|
|
92
|
-
t,
|
|
93
|
-
actions
|
|
94
|
-
)
|
|
95
|
-
);
|
|
92
|
+
command.action(async (names, options) => list(provider, names, t, actions));
|
|
96
93
|
|
|
97
94
|
if (actions) {
|
|
98
95
|
for (const [an, actionOptions] of Object.entries(actions)) {
|
|
@@ -100,13 +97,16 @@ for (const t of [
|
|
|
100
97
|
const command = program.command(
|
|
101
98
|
`${t.name}-${an} ${actionOptions.suffix}`
|
|
102
99
|
);
|
|
103
|
-
|
|
104
100
|
command.action(async (names, options) => {
|
|
105
101
|
await actionOptions.execute(provider, names, options);
|
|
106
102
|
});
|
|
107
103
|
}
|
|
108
104
|
if (actionOptions.executeInstance) {
|
|
109
|
-
command.option(
|
|
105
|
+
command.option(
|
|
106
|
+
`--${an}`,
|
|
107
|
+
actionOptions.description,
|
|
108
|
+
() => (action = an)
|
|
109
|
+
);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -115,7 +115,7 @@ for (const t of [
|
|
|
115
115
|
program.parse(process.argv);
|
|
116
116
|
|
|
117
117
|
function normalize(names) {
|
|
118
|
-
return names.length === 0 ? ["
|
|
118
|
+
return names.length === 0 ? ["**/*"] : names;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function listAttributes(object, attributes, options) {
|
|
@@ -154,11 +154,10 @@ async function list(provider, names, type, actions) {
|
|
|
154
154
|
const json = [];
|
|
155
155
|
|
|
156
156
|
for await (const object of provider[type.collectionName](normalize(names))) {
|
|
157
|
-
if (actions) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
157
|
+
if (actions && action) {
|
|
158
|
+
const a = actions[action];
|
|
159
|
+
if (a?.executeInstance) {
|
|
160
|
+
await a.executeInstance(object, options);
|
|
162
161
|
}
|
|
163
162
|
}
|
|
164
163
|
|
|
@@ -168,7 +167,7 @@ async function list(provider, names, type, actions) {
|
|
|
168
167
|
if (options.identifier) {
|
|
169
168
|
console.log(`${object.fullName}:`);
|
|
170
169
|
}
|
|
171
|
-
listAttributes(object, options.attribute ||
|
|
170
|
+
listAttributes(object, options.attribute || type.attributes, options);
|
|
172
171
|
}
|
|
173
172
|
}
|
|
174
173
|
|
|
@@ -197,12 +196,9 @@ function type(clazz, extra) {
|
|
|
197
196
|
actions: {
|
|
198
197
|
update: {
|
|
199
198
|
description: `update ${clazz.type} attributes`,
|
|
200
|
-
executeInstance: object => {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
object.update();
|
|
199
|
+
executeInstance: async object => {
|
|
200
|
+
Object.assign(object, properties);
|
|
201
|
+
await object.update();
|
|
206
202
|
}
|
|
207
203
|
},
|
|
208
204
|
...extra
|