repo-util 1.11.11 → 1.12.0

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2021 by arlac77
1
+ Copyright (c) 2021-2022 by arlac77
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-util",
3
- "version": "1.11.11",
3
+ "version": "1.12.0",
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",
24
+ "aggregation-repository-provider": "^4.0.20",
25
+ "bitbucket-repository-provider": "^3.10.6",
26
26
  "commander": "^8.3.0",
27
- "gitea-repository-provider": "^1.16.52",
28
- "github-repository-provider": "^7.25.6",
29
- "local-repository-provider": "^7.0.111"
27
+ "gitea-repository-provider": "^1.16.59",
28
+ "github-repository-provider": "^7.25.16",
29
+ "local-repository-provider": "^7.0.114"
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",
@@ -26,11 +26,8 @@ program
26
26
  .option("--dry", "do not create branch/pull request")
27
27
  .option("--trace", "log level trace")
28
28
  .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
- })
29
+ .option("-D --define <a=b>", "define property", str =>
30
+ Object.assign(properties, Object.fromEntries([str.split(/=/)]))
34
31
  );
35
32
 
36
33
  for (const o of [
@@ -90,27 +87,25 @@ function normalize(names) {
90
87
  }
91
88
 
92
89
  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 action of Object.keys(actions)) {
103
- if (options[action]) {
104
- await actions[action].execute();
105
- }
90
+ const json = [];
91
+
92
+ for await (const object of provider[slot](normalize(names))) {
93
+ if (actions) {
94
+ for (const [name, action] of Object.entries(actions)) {
95
+ if (options[name]) {
96
+ await action.execute();
106
97
  }
107
98
  }
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();
99
+ }
100
+ // modify
101
+ if (Object.keys(properties).length > 0) {
102
+ for (const [k, v] of Object.entries(properties)) {
103
+ object[k] = v;
104
+ }
105
+ await object.update();
106
+ } else {
107
+ if (options.json) {
108
+ json.push(object);
114
109
  } else {
115
110
  let prefix = "";
116
111
  if (object.repository) {
@@ -122,4 +117,8 @@ async function list(provider, names, options, slot, attributes, actions) {
122
117
  }
123
118
  }
124
119
  }
120
+
121
+ if (options.json) {
122
+ console.log(JSON.stringify(json));
123
+ }
125
124
  }