repo-util 1.9.7 → 1.10.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-util",
3
- "version": "1.9.7",
3
+ "version": "1.10.5",
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": "^3.2.54",
25
- "bitbucket-repository-provider": "^3.9.4",
24
+ "aggregation-repository-provider": "^4.0.2",
25
+ "bitbucket-repository-provider": "^3.9.10",
26
26
  "commander": "^8.3.0",
27
- "gitea-repository-provider": "^1.16.32",
28
- "github-repository-provider": "^7.23.25",
29
- "local-repository-provider": "^7.0.102"
27
+ "gitea-repository-provider": "^1.16.35",
28
+ "github-repository-provider": "^7.23.34",
29
+ "local-repository-provider": "^7.0.106"
30
30
  },
31
31
  "devDependencies": {
32
32
  "ava": "^3.15.0",
33
33
  "c8": "^7.10.0",
34
- "execa": "^5.1.1",
35
- "semantic-release": "^18.0.0"
34
+ "execa": "^6.0.0",
35
+ "semantic-release": "^18.0.1"
36
36
  },
37
37
  "engines": {
38
- "node": ">=16.10.0"
38
+ "node": ">=16.13.0"
39
39
  },
40
40
  "repository": {
41
41
  "type": "git",
@@ -33,65 +33,30 @@ program
33
33
  })
34
34
  );
35
35
 
36
- program
37
- .command("providers")
38
- .option("--json", "output as json")
39
- .action(async options => {
40
- const provider = await prepareProvider();
41
- console.log(
42
- [
43
- ...provider.providers.map(
44
- p => `${p.name}: ${JSON.stringify(p.toJSON())}`
45
- )
46
- ].join("\n")
47
- );
48
- });
49
-
50
36
  for (const o of [
51
- ["repository-group", "repositoryGroups", "name"],
52
- ["repository", "repositories", "name"],
53
- ["branch", "branches", "fullName"]
37
+ ["provider", "providers", ["name"]],
38
+ ["repository-group", "repositoryGroups", ["name"]],
39
+ ["repository", "repositories", ["fullName"]],
40
+ ["branch", "branches", ["fullName"]],
41
+ ["hook", "hooks", ["url"]]
54
42
  ]) {
55
43
  program
56
- .command(`${o[0]} <names...>`)
44
+ .command(`${o[0]} <name...>`)
57
45
  .option("--json", "output as json")
46
+ .option("-a, --attribute <attributes>", "list attribute", a => a.split(","))
58
47
  .action(async (names, options) =>
59
- list(await prepareProvider(options), names, options, o[1], o[2])
48
+ list(
49
+ await prepareProvider(options),
50
+ names,
51
+ options,
52
+ o[1],
53
+ options.attribute ? options.attribute : o[2]
54
+ )
60
55
  );
61
56
  }
62
57
 
63
58
  program
64
- .command("hooks <name...>")
65
- .option("--json", "output as json")
66
- .action(async (names, options) => {
67
- const provider = await prepareProvider();
68
-
69
- if (options.json) {
70
- const json = [];
71
-
72
- for await (const repository of provider.repositories(names)) {
73
- const r = { name: repository.fullName, hooks: [] };
74
- for await (const hook of repository.hooks()) {
75
- r.hooks.push(hook);
76
- }
77
-
78
- if (r.hooks.length > 0) {
79
- json.push(r);
80
- }
81
- }
82
- console.log(JSON.stringify(json));
83
- } else {
84
- for await (const repository of provider.repositories(names)) {
85
- for await (const hook of repository.hooks()) {
86
- console.log(repository.fullName);
87
- console.log(" " + hook.url);
88
- }
89
- }
90
- }
91
- });
92
-
93
- program
94
- .command("pull-request <names...>")
59
+ .command("pull-request <name...>")
95
60
  .option("--json", "output as json")
96
61
  .option("--merge", "merge the pr")
97
62
  .action(async (names, options) => {
@@ -120,7 +85,7 @@ program
120
85
  });
121
86
 
122
87
  program
123
- .command("update-repository <names...>")
88
+ .command("update-repository <name...>")
124
89
  .action(async (names, options) => {
125
90
  const provider = await prepareProvider();
126
91
  for await (const repository of provider.repositories(names)) {
@@ -132,7 +97,7 @@ program
132
97
  });
133
98
 
134
99
  program
135
- .command("create-repository <names...>")
100
+ .command("create-repository <name...>")
136
101
  .action(async (names, options) => {
137
102
  const provider = await prepareProvider();
138
103
  for (const name of names) {
@@ -142,7 +107,7 @@ program
142
107
 
143
108
  program.parse(process.argv);
144
109
 
145
- async function list(provider, name, options, slot, nameAttribute = "name") {
110
+ async function list(provider, name, options, slot, attributes) {
146
111
  if (options.json) {
147
112
  const json = [];
148
113
  for await (const object of provider[slot](name)) {
@@ -151,7 +116,13 @@ async function list(provider, name, options, slot, nameAttribute = "name") {
151
116
  console.log(JSON.stringify(json));
152
117
  } else {
153
118
  for await (const object of provider[slot](name)) {
154
- console.log(object[nameAttribute]);
119
+ let prefix= "";
120
+ if(object.repository) {
121
+ prefix = object.repository.fullName + ": ";
122
+ }
123
+ for (const a of attributes) {
124
+ console.log(prefix,object[a]);
125
+ }
155
126
  }
156
127
  }
157
128
  }