repo-util 1.11.14 → 1.12.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 +9 -9
- package/src/repo-util-cli.mjs +25 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repo-util",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,21 +21,21 @@
|
|
|
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": "^4.0.
|
|
25
|
-
"bitbucket-repository-provider": "^3.10.
|
|
26
|
-
"commander": "^
|
|
27
|
-
"gitea-repository-provider": "^1.16.
|
|
28
|
-
"github-repository-provider": "^7.25.
|
|
29
|
-
"local-repository-provider": "^7.0
|
|
24
|
+
"aggregation-repository-provider": "^4.0.30",
|
|
25
|
+
"bitbucket-repository-provider": "^3.10.10",
|
|
26
|
+
"commander": "^9.0.0",
|
|
27
|
+
"gitea-repository-provider": "^1.16.67",
|
|
28
|
+
"github-repository-provider": "^7.25.27",
|
|
29
|
+
"local-repository-provider": "^7.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"ava": "^4.0.1",
|
|
33
33
|
"c8": "^7.11.0",
|
|
34
34
|
"execa": "^6.0.0",
|
|
35
|
-
"semantic-release": "^
|
|
35
|
+
"semantic-release": "^19.0.2"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": ">=16.13.
|
|
38
|
+
"node": ">=16.13.2"
|
|
39
39
|
},
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
package/src/repo-util-cli.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { readFileSync } from "fs";
|
|
4
|
-
import program,
|
|
4
|
+
import { program, Option } from "commander";
|
|
5
5
|
import AggregationProvider from "aggregation-repository-provider";
|
|
6
|
-
import { asArray } from "repository-provider";
|
|
7
6
|
|
|
8
7
|
process.on("uncaughtException", err => console.error(err));
|
|
9
8
|
process.on("unhandledRejection", reason => console.error(reason));
|
|
@@ -26,11 +25,8 @@ program
|
|
|
26
25
|
.option("--dry", "do not create branch/pull request")
|
|
27
26
|
.option("--trace", "log level trace")
|
|
28
27
|
.option("--debug", "log level debug")
|
|
29
|
-
.option("-
|
|
30
|
-
|
|
31
|
-
const [k, v] = value.split(/=/);
|
|
32
|
-
properties[k] = v;
|
|
33
|
-
})
|
|
28
|
+
.option("-D --define <a=b>", "define property", str =>
|
|
29
|
+
Object.assign(properties, Object.fromEntries([str.split(/=/)]))
|
|
34
30
|
);
|
|
35
31
|
|
|
36
32
|
for (const o of [
|
|
@@ -90,36 +86,34 @@ function normalize(names) {
|
|
|
90
86
|
}
|
|
91
87
|
|
|
92
88
|
async function list(provider, names, options, slot, attributes, actions) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
for await (const object of provider[slot](normalize(names))) {
|
|
101
|
-
if (actions) {
|
|
102
|
-
for (const [name, action] of Object.entries(actions)) {
|
|
103
|
-
if (options[name]) {
|
|
104
|
-
await action.execute();
|
|
105
|
-
}
|
|
89
|
+
const json = [];
|
|
90
|
+
|
|
91
|
+
for await (const object of provider[slot](normalize(names))) {
|
|
92
|
+
if (actions) {
|
|
93
|
+
for (const [name, action] of Object.entries(actions)) {
|
|
94
|
+
if (options[name]) {
|
|
95
|
+
await action.execute();
|
|
106
96
|
}
|
|
107
97
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
98
|
+
}
|
|
99
|
+
// modify
|
|
100
|
+
if (Object.keys(properties).length > 0) {
|
|
101
|
+
for (const [k, v] of Object.entries(properties)) {
|
|
102
|
+
object[k] = v;
|
|
103
|
+
}
|
|
104
|
+
await object.update();
|
|
105
|
+
} else {
|
|
106
|
+
if (options.json) {
|
|
107
|
+
json.push(object);
|
|
114
108
|
} else {
|
|
115
|
-
let prefix = "";
|
|
116
|
-
if (object.repository) {
|
|
117
|
-
prefix = object.repository.fullName + ": ";
|
|
118
|
-
}
|
|
119
109
|
for (const a of attributes) {
|
|
120
|
-
console.log(
|
|
110
|
+
console.log(object.fullName + ":", object[a]);
|
|
121
111
|
}
|
|
122
112
|
}
|
|
123
113
|
}
|
|
124
114
|
}
|
|
115
|
+
|
|
116
|
+
if (options.json) {
|
|
117
|
+
console.log(JSON.stringify(json));
|
|
118
|
+
}
|
|
125
119
|
}
|