@gitbeaker/cli 42.5.0 → 43.1.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/README.md CHANGED
@@ -18,12 +18,6 @@
18
18
  <br>
19
19
  <sup>Special thanks to:</sup>
20
20
  <br>
21
- <br>
22
-
23
- <a href="https://wearecws.com/">
24
- <img src="../../.github/ASSETS/cws.svg" width="180">
25
- </a>
26
- <br>
27
21
  <br>
28
22
  <a href="http://coderabbit.ai">
29
23
  <img src="../../.github/ASSETS/coderabbit.png" width="180">
@@ -243,6 +237,7 @@ GITBEAKER_CAMELIZE=true
243
237
  <td align="center" valign="top" width="0.33%"><a href="https://github.com/enduity"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/19674002?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Endrik Einberg"/></td>
244
238
  <td align="center" valign="top" width="0.33%"><a href="https://note.itswhat.me/"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/38807139?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Bryan Lee"/></td>
245
239
  <td align="center" valign="top" width="0.33%"><a href="https://github.com/zk-kb4"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/42388953?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Zack"/></td>
240
+ <td align="center" valign="top" width="0.33%"><a href="https://github.com/kayw-geek"><img src="https://images.weserv.nl/?url=https://avatars.githubusercontent.com/u/29700073?v=4&h=25&w=25&fit=cover&mask=circle&maxage=7d" alt="Kay W."/></td>
246
241
  </tr>
247
242
  </p>
248
243
 
package/dist/index.mjs CHANGED
@@ -7,29 +7,30 @@ import * as Gitbeaker from "@gitbeaker/rest";
7
7
  import API_MAP from "@gitbeaker/core/map.json" with { type: "json" };
8
8
 
9
9
  // src/utils.ts
10
- import { camelize, decamelize, depascalize } from "xcase";
11
- function param(value) {
12
- let cleaned = value;
13
- const exceptions = [
14
- "GitLabCI",
15
- "YML",
16
- "GPG",
17
- "SSH",
18
- "IId",
19
- "NPM",
20
- "NuGet",
21
- "DORA4",
22
- "LDAP",
23
- "CICD",
24
- "SAML",
25
- "SCIM",
26
- "PyPI"
27
- ];
28
- exceptions.filter((e) => value.includes(e)).forEach((ex) => {
29
- cleaned = cleaned.replace(ex, ex.charAt(0).toUpperCase() + ex.slice(1).toLowerCase());
10
+ import { camelize, depascalize } from "xcase";
11
+ var NORMALIZED_EXCEPTION_TERMS = [
12
+ "GitLabCI",
13
+ "YML",
14
+ "GPG",
15
+ "SSH",
16
+ "IId",
17
+ "NPM",
18
+ "NuGet",
19
+ "DORA4",
20
+ "LDAP",
21
+ "CICD",
22
+ "SAML",
23
+ "SCIM",
24
+ "PyPI"
25
+ ].reduce((prev, cur) => {
26
+ return { ...prev, [cur]: cur.charAt(0).toUpperCase() + cur.slice(1).toLowerCase() };
27
+ }, {});
28
+ function normalizeTerm(value) {
29
+ let normalized = value;
30
+ Object.keys(NORMALIZED_EXCEPTION_TERMS).filter((e) => value.includes(e)).forEach((ex) => {
31
+ normalized = normalized.replace(ex, NORMALIZED_EXCEPTION_TERMS[ex]);
30
32
  });
31
- const decamelized = decamelize(cleaned, "-");
32
- return decamelized !== cleaned ? decamelized : depascalize(cleaned, "-");
33
+ return depascalize(normalized, "-");
33
34
  }
34
35
  function normalizeEnviromentVariables(env) {
35
36
  const normalized = {};
@@ -110,7 +111,7 @@ function getGlobalConfig(env = process.env) {
110
111
  },
111
112
  "gb-sudo": {
112
113
  alias: "gl-sudo",
113
- desc: "[Sudo](https://docs.gitlab.com/ee/api/#sudo) query parameter",
114
+ desc: "Sudo query parameter - https://docs.gitlab.com/ee/api/#sudo",
114
115
  type: "string",
115
116
  defaultValue: normalEnv.GITBEAKER_SUDO
116
117
  },
@@ -128,13 +129,13 @@ function getGlobalConfig(env = process.env) {
128
129
  },
129
130
  "gb-profile-token": {
130
131
  alias: "gl-profile-token",
131
- desc: "[Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html)",
132
+ desc: `Requests Profiles Token - https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html`,
132
133
  type: "string",
133
134
  defaultValue: normalEnv.GITBEAKER_PROFILE_TOKEN
134
135
  },
135
136
  "gb-profile-mode": {
136
137
  alias: "gl-profile-mode",
137
- desc: "[Requests Profiles Token](https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html)",
138
+ desc: "Requests Profiles Token - https://docs.gitlab.com/ee/administration/monitoring/performance/request_profiling.html",
138
139
  type: "string",
139
140
  defaultValue: normalEnv.GITBEAKER_PROFILE_MODE
140
141
  }
@@ -148,7 +149,7 @@ function getExposedAPIs(map) {
148
149
  // src/cli.ts
149
150
  function setupAPIMethods(setupArgs, methodArgs) {
150
151
  methodArgs.forEach((name) => {
151
- setupArgs.positional(`[--${param(name)}] <${param(name)}>`, {
152
+ setupArgs.positional(`[--${normalizeTerm(name)}] <${normalizeTerm(name)}>`, {
152
153
  group: "Required Options",
153
154
  type: "string"
154
155
  });
@@ -161,21 +162,19 @@ function runAPIMethod(ctx, args, apiName, method) {
161
162
  const s = new Gitbeaker[apiName](initArgs);
162
163
  return s[method.name](...Object.values(coreArgs), optionalArgs).then((r) => {
163
164
  ctx.output = JSON.stringify(r, null, 3);
164
- }).catch((e) => {
165
- ctx.output = e;
166
165
  });
167
166
  }
168
167
  function setupAPIs(setupArgs, apiName, methods) {
169
168
  const globalConfig = getGlobalConfig();
170
169
  Object.entries(globalConfig).forEach(([k, v]) => {
171
- setupArgs.option(`${k} <value>`, {
170
+ setupArgs.option(`--${k} <value>`, {
172
171
  group: "Base Options",
173
172
  ...v
174
173
  });
175
174
  });
176
- for (let i = 1; i < methods.length; i += 1) {
175
+ for (let i = 0; i < methods.length; i += 1) {
177
176
  const method = methods[i];
178
- setupArgs.command(param(method.name), {
177
+ setupArgs.command(normalizeTerm(method.name), {
179
178
  setup: (setupMethodArgs) => setupAPIMethods(setupMethodArgs, method.args),
180
179
  run: (args, ctx) => runAPIMethod(ctx, args, apiName, method)
181
180
  });
@@ -189,13 +188,13 @@ var optionStyle = Chalk.white.bold;
189
188
  var descriptionStyle = Chalk.hex("#848484");
190
189
  var hintStyle = Chalk.hex("#6a5f88");
191
190
  var cli = Sywac.version("-v, --version").help("-h, --help").showHelpByDefault().epilogue(`Copyright ${(/* @__PURE__ */ new Date()).getFullYear()}`).style({
192
- usagePrefix: usageStyle,
193
- group: groupStyle,
194
- flags: optionStyle,
195
- usageCommandPlaceholder: commandStyle,
196
- usageOptionsPlaceholder: optionStyle,
197
- desc: descriptionStyle,
198
- hints: hintStyle
191
+ usagePrefix: (s) => usageStyle(s),
192
+ group: (s) => groupStyle(s),
193
+ usageCommandPlaceholder: (s) => commandStyle(s),
194
+ flags: (s) => optionStyle(s),
195
+ usageOptionsPlaceholder: (s) => optionStyle(s),
196
+ desc: (s) => descriptionStyle(s),
197
+ hints: (s) => hintStyle(s)
199
198
  });
200
199
  cli.boolean("-g --global-args", {
201
200
  desc: "Show global arguments currently set in the environment variables"
@@ -208,7 +207,7 @@ cli.command("*", (argv, ctx) => {
208
207
  });
209
208
  var exposedAPIs = getExposedAPIs(API_MAP);
210
209
  Object.entries(exposedAPIs).forEach(([apiName, methods]) => {
211
- cli.command(param(apiName), {
210
+ cli.command(normalizeTerm(apiName), {
212
211
  desc: `The ${apiName} API`,
213
212
  setup: (setupArgs) => setupAPIs(setupArgs, apiName, methods)
214
213
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitbeaker/cli",
3
- "version": "42.5.0",
3
+ "version": "43.1.0",
4
4
  "description": "CLI implementation of the GitLab API.",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -39,15 +39,15 @@
39
39
  "lint:fix": "yarn lint --fix"
40
40
  },
41
41
  "dependencies": {
42
- "@gitbeaker/core": "^42.5.0",
43
- "@gitbeaker/rest": "^42.5.0",
44
- "chalk": "4.1.2",
42
+ "@gitbeaker/core": "^43.1.0",
43
+ "@gitbeaker/rest": "^43.1.0",
44
+ "chalk": "^5.4.1",
45
45
  "sywac": "^1.3.0",
46
46
  "xcase": "^2.0.1"
47
47
  },
48
48
  "devDependencies": {
49
- "tsup": "^8.1.0",
50
- "typescript": "^5.5.3"
49
+ "tsup": "^8.5.0",
50
+ "typescript": "^5.8.3"
51
51
  },
52
- "gitHead": "328ed84855441f2c20cfc73c9a31029fa2e51512"
52
+ "gitHead": "095f01fd08b131e05910667511276bcafae9888c"
53
53
  }