repo-util 1.9.8 → 1.10.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-util",
3
- "version": "1.9.8",
3
+ "version": "1.10.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": "^3.2.54",
25
- "bitbucket-repository-provider": "^3.9.6",
24
+ "aggregation-repository-provider": "^4.0.0",
25
+ "bitbucket-repository-provider": "^3.9.8",
26
26
  "commander": "^8.3.0",
27
- "gitea-repository-provider": "^1.16.32",
28
- "github-repository-provider": "^7.23.27",
29
- "local-repository-provider": "^7.0.103"
27
+ "gitea-repository-provider": "^1.16.33",
28
+ "github-repository-provider": "^7.23.31",
29
+ "local-repository-provider": "^7.0.105"
30
30
  },
31
31
  "devDependencies": {
32
32
  "ava": "^3.15.0",
33
33
  "c8": "^7.10.0",
34
- "execa": "^5.1.1",
34
+ "execa": "^6.0.0",
35
35
  "semantic-release": "^18.0.0"
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,30 +33,24 @@ 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", ["name"]],
40
+ ["branch", "branches", ["fullName"]]
54
41
  ]) {
55
42
  program
56
- .command(`${o[0]} <names...>`)
43
+ .command(`${o[0]} <name...>`)
57
44
  .option("--json", "output as json")
45
+ .option("-a, --attribute <attributes>", "list attribute", a => a.split(","))
58
46
  .action(async (names, options) =>
59
- list(await prepareProvider(options), names, options, o[1], o[2])
47
+ list(
48
+ await prepareProvider(options),
49
+ names,
50
+ options,
51
+ o[1],
52
+ options.attribute ? options.attribute : o[2]
53
+ )
60
54
  );
61
55
  }
62
56
 
@@ -91,7 +85,7 @@ program
91
85
  });
92
86
 
93
87
  program
94
- .command("pull-request <names...>")
88
+ .command("pull-request <name...>")
95
89
  .option("--json", "output as json")
96
90
  .option("--merge", "merge the pr")
97
91
  .action(async (names, options) => {
@@ -120,7 +114,7 @@ program
120
114
  });
121
115
 
122
116
  program
123
- .command("update-repository <names...>")
117
+ .command("update-repository <name...>")
124
118
  .action(async (names, options) => {
125
119
  const provider = await prepareProvider();
126
120
  for await (const repository of provider.repositories(names)) {
@@ -132,7 +126,7 @@ program
132
126
  });
133
127
 
134
128
  program
135
- .command("create-repository <names...>")
129
+ .command("create-repository <name...>")
136
130
  .action(async (names, options) => {
137
131
  const provider = await prepareProvider();
138
132
  for (const name of names) {
@@ -142,7 +136,7 @@ program
142
136
 
143
137
  program.parse(process.argv);
144
138
 
145
- async function list(provider, name, options, slot, nameAttribute = "name") {
139
+ async function list(provider, name, options, slot, attributes) {
146
140
  if (options.json) {
147
141
  const json = [];
148
142
  for await (const object of provider[slot](name)) {
@@ -151,7 +145,9 @@ async function list(provider, name, options, slot, nameAttribute = "name") {
151
145
  console.log(JSON.stringify(json));
152
146
  } else {
153
147
  for await (const object of provider[slot](name)) {
154
- console.log(object[nameAttribute]);
148
+ for (const a of attributes) {
149
+ console.log(object[a]);
150
+ }
155
151
  }
156
152
  }
157
153
  }