repo-util 1.11.13 → 1.12.2

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.
Files changed (2) hide show
  1. package/package.json +10 -10
  2. package/src/repo-util-cli.mjs +24 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-util",
3
- "version": "1.11.13",
3
+ "version": "1.12.2",
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.15",
25
- "bitbucket-repository-provider": "^3.10.3",
26
- "commander": "^8.3.0",
27
- "gitea-repository-provider": "^1.16.52",
28
- "github-repository-provider": "^7.25.9",
29
- "local-repository-provider": "^7.0.111"
24
+ "aggregation-repository-provider": "^4.0.27",
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.22",
29
+ "local-repository-provider": "^7.0.117"
30
30
  },
31
31
  "devDependencies": {
32
- "ava": "^4.0.0",
32
+ "ava": "^4.0.1",
33
33
  "c8": "^7.11.0",
34
34
  "execa": "^6.0.0",
35
- "semantic-release": "^18.0.1"
35
+ "semantic-release": "^19.0.2"
36
36
  },
37
37
  "engines": {
38
- "node": ">=16.13.1"
38
+ "node": ">=16.13.2"
39
39
  },
40
40
  "repository": {
41
41
  "type": "git",
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { readFileSync } from "fs";
4
- import program, { Option } from "commander";
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("-d, --define <...key=value>", "set option", values =>
30
- asArray(values).forEach(value => {
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,27 +86,25 @@ function normalize(names) {
90
86
  }
91
87
 
92
88
  async function list(provider, names, options, slot, attributes, actions) {
93
- if (options.json) {
94
- const json = [];
95
- for await (const object of provider[slot](normalize(names))) {
96
- json.push(object);
97
- }
98
- console.log(JSON.stringify(json));
99
- } else {
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
- // modify
109
- if (Object.keys(properties).length > 0) {
110
- for (const [k, v] of Object.entries(properties)) {
111
- object[k] = v;
112
- }
113
- await object.update();
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
109
  let prefix = "";
116
110
  if (object.repository) {
@@ -122,4 +116,8 @@ async function list(provider, names, options, slot, attributes, actions) {
122
116
  }
123
117
  }
124
118
  }
119
+
120
+ if (options.json) {
121
+ console.log(JSON.stringify(json));
122
+ }
125
123
  }