@vc-shell/api-client-generator 1.1.10 → 1.1.11

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.1.11](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.10...v1.1.11) (2025-05-23)
2
+
3
+
4
+
1
5
  ## [1.1.10](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.9...v1.1.10) (2025-05-22)
2
6
 
3
7
 
@@ -1,175 +1,212 @@
1
- import e from "chalk";
2
- import { sync as D } from "cross-spawn";
3
- import { resolveConfig as j } from "vite";
4
- import { existsSync as w, mkdirSync as I, writeFileSync as R, readFileSync as O } from "node:fs";
5
- import h, { dirname as B, resolve as E, join as A, relative as C } from "node:path";
6
- import { fileURLToPath as b } from "node:url";
7
- import { cwd as x } from "node:process";
1
+ import t from "chalk";
2
+ import { sync as E } from "cross-spawn";
3
+ import { resolveConfig as T } from "vite";
4
+ import { existsSync as _, mkdirSync as I, writeFileSync as B, readFileSync as D } from "node:fs";
5
+ import y, { dirname as S, resolve as R, join as w, relative as x } from "node:path";
6
+ import { fileURLToPath as j } from "node:url";
7
+ import { cwd as k } from "node:process";
8
8
  import L from "mri";
9
- const S = b(import.meta.url), N = B(S);
10
- class k {
9
+ const b = j(import.meta.url), F = S(b);
10
+ class $ {
11
11
  workingDirectory;
12
12
  generatorDirectory;
13
13
  assetsDirectory;
14
14
  apiClientDirectory;
15
15
  nswagPaths;
16
- constructor(r) {
17
- this.workingDirectory = x(), this.generatorDirectory = E(N, ".."), this.assetsDirectory = A(this.generatorDirectory, "public", "assets"), this.apiClientDirectory = E(this.workingDirectory, r), this.nswagPaths = {
18
- configuration: A(C(this.workingDirectory, this.assetsDirectory), "config.nswag"),
16
+ constructor(e) {
17
+ this.workingDirectory = k(), this.generatorDirectory = R(F, ".."), this.assetsDirectory = w(this.generatorDirectory, "public", "assets"), this.apiClientDirectory = R(this.workingDirectory, e), this.nswagPaths = {
18
+ configuration: w(x(this.workingDirectory, this.assetsDirectory), "config.nswag"),
19
19
  authApiBase: "authApiBase.ts",
20
20
  templates: "templates"
21
21
  };
22
22
  }
23
- resolveApiClientPaths(r) {
24
- const p = `${r.toLowerCase()}.ts`;
23
+ resolveApiClientPaths(e) {
24
+ const p = `${e.toLowerCase()}.ts`;
25
25
  return {
26
26
  fileName: p,
27
- nswag: A(C(this.assetsDirectory, this.apiClientDirectory), p),
28
- console: A(C(this.workingDirectory, this.apiClientDirectory), p)
27
+ nswag: w(x(this.assetsDirectory, this.apiClientDirectory), p),
28
+ console: w(x(this.workingDirectory, this.apiClientDirectory), p)
29
29
  };
30
30
  }
31
31
  }
32
- function T(t, r, p = []) {
33
- const n = { ...t };
32
+ function O(o, e, p = []) {
33
+ const r = { ...o };
34
34
  for (const a of p)
35
- a in r && (n[a] = r[a]);
36
- for (const [a, i] of Object.entries(r)) {
37
- const l = a;
38
- a in n && typeof n[l] == "object" && !Array.isArray(n[l]) && typeof i == "object" && !Array.isArray(i) && i !== null ? n[l] = { ...n[l], ...i } : p.includes(a) || (n[l] = i);
35
+ a in e && (r[a] = e[a]);
36
+ for (const [a, s] of Object.entries(e)) {
37
+ const c = a;
38
+ a in r && typeof r[c] == "object" && !Array.isArray(r[c]) && typeof s == "object" && !Array.isArray(s) && s !== null ? r[c] = { ...r[c], ...s } : p.includes(a) || (r[c] = s);
39
39
  }
40
- return n;
40
+ return r;
41
41
  }
42
- function M(t, r, p, n) {
42
+ function v(o, e, p, r) {
43
43
  const a = {
44
44
  extends: "@vc-shell/ts-config/tsconfig.json",
45
45
  compilerOptions: {
46
46
  baseUrl: ".",
47
- declarationDir: h.join(p, "types"),
48
- outDir: n,
47
+ declarationDir: y.join(p, "types"),
48
+ outDir: r,
49
49
  rootDir: "./"
50
50
  },
51
51
  files: [],
52
52
  include: ["*.ts"]
53
53
  };
54
- let i = { ...a };
55
- if (w(t))
54
+ let s = { ...a };
55
+ if (_(o))
56
56
  try {
57
- const l = O(t, "utf-8");
57
+ const c = D(o, "utf-8");
58
58
  try {
59
- const o = JSON.parse(l);
60
- i = T(a, o), o.compilerOptions && typeof o.compilerOptions == "object" && (i.compilerOptions = {
59
+ const n = JSON.parse(c);
60
+ s = O(a, n), n.compilerOptions && typeof n.compilerOptions == "object" && (s.compilerOptions = {
61
61
  ...a.compilerOptions,
62
- ...o.compilerOptions
63
- }, i.compilerOptions.outDir = n, i.compilerOptions.declarationDir = h.join(n, "types"));
64
- const s = Array.isArray(o.files) ? o.files : [];
65
- i.files = Array.from(/* @__PURE__ */ new Set([...r, ...s])), console.log("api-client-generator %s Updated existing tsconfig.json", e.greenBright("success"));
66
- } catch (o) {
62
+ ...n.compilerOptions
63
+ }, s.compilerOptions.outDir = r, s.compilerOptions.declarationDir = y.join(r, "types"));
64
+ const h = Array.isArray(n.files) ? n.files : [];
65
+ s.files = Array.from(/* @__PURE__ */ new Set([...e, ...h])), console.log("api-client-generator %s Updated existing tsconfig.json", t.greenBright("success"));
66
+ } catch (n) {
67
67
  console.error(
68
68
  "api-client-generator %s Failed to parse existing tsconfig.json, creating new one",
69
- e.yellow("warning"),
70
- o
71
- ), i = { ...a }, i.files = r;
69
+ t.yellow("warning"),
70
+ n
71
+ ), s = { ...a }, s.files = e;
72
72
  }
73
- } catch (l) {
74
- console.error("api-client-generator %s Failed to read existing tsconfig.json", e.red("error"), l);
73
+ } catch (c) {
74
+ console.error("api-client-generator %s Failed to read existing tsconfig.json", t.red("error"), c);
75
75
  }
76
76
  else
77
- i.files = r, console.log("api-client-generator %s Created new tsconfig.json", e.greenBright("success"));
78
- return i;
77
+ s.files = e, console.log("api-client-generator %s Created new tsconfig.json", t.greenBright("success"));
78
+ return s;
79
79
  }
80
- function _(t) {
81
- return t = t.replace(/\.(js|ts)$/i, ""), t = t.replace(/\/\.\//g, "/"), t !== "." && !t.startsWith("./") && (t = "./" + t), t = t.replace(/\/+/g, "/"), t = t.replace(/\.\.\//g, ""), t;
80
+ function A(o) {
81
+ let e = o;
82
+ const p = [".d.ts", ".ts", ".js"];
83
+ let r;
84
+ do {
85
+ r = !1;
86
+ for (const a of p)
87
+ if (e.toLowerCase().endsWith(a.toLowerCase())) {
88
+ e = e.substring(0, e.length - a.length), r = !0;
89
+ break;
90
+ }
91
+ } while (r);
92
+ return e = e.replace(/\/\.\//g, "/"), e = e.replace(/\/+/g, "/"), e = e.replace(/\.\.\//g, ""), e !== "." && !e.startsWith("./") && !e.startsWith("/") && !y.isAbsolute(e) && (e = "./" + e), e.startsWith("//") && (e = "./" + e.substring(2)), e !== "." && e.startsWith("/") && !e.startsWith("./") && !y.isAbsolute(e) && (e = "." + e), e !== "." && e.startsWith("././") && (e = "./" + e.substring(3)), e;
82
93
  }
83
- function y(t) {
84
- const r = _(t);
85
- return r === "." ? "" : r.replace(/^\.\//, "").toLowerCase();
94
+ function P(o) {
95
+ let e = A(o);
96
+ return e = y.basename(e), e = e.replace(/^virtocommerce\./i, ""), e.toLowerCase();
86
97
  }
87
- function v(t) {
88
- const r = y(t);
89
- return r ? [`./${r}`] : [];
98
+ function M(o) {
99
+ return o ? [`./${o}`, `./virtocommerce.${o}`] : [];
90
100
  }
91
- function F(t, r, p, n) {
92
- const a = {}, i = /* @__PURE__ */ new Set(), l = [];
93
- for (const o of t) {
94
- const s = y(o);
95
- if (!s) continue;
96
- l.includes(s) || l.push(s);
97
- const c = `./${r}/${s}.js`, g = `./${r}/types/${s}.d.ts`, f = {
98
- import: c,
99
- types: g
100
- }, m = v(s);
101
- for (const P of m)
102
- a[P] = f, i.add(s), n && console.log(
103
- "api-client-generator %s Created export: %s -> %s, %s",
104
- e.blue("debug"),
105
- e.whiteBright(P),
106
- e.whiteBright(c),
107
- e.whiteBright(g)
101
+ function U(o, e, p, r) {
102
+ const a = {}, s = /* @__PURE__ */ new Set();
103
+ for (const i of o) {
104
+ const l = P(i);
105
+ if (!l) continue;
106
+ const g = `virtocommerce.${l}`, d = `./${e}/${g}.js`, m = `./${e}/types/${g}.d.ts`, f = { import: d, types: m }, u = M(l);
107
+ for (const C of u)
108
+ a[C] = f, r && console.log(
109
+ "api-client-generator %s Generated standard export: %s -> { import: %s, types: %s }",
110
+ t.blue("debug"),
111
+ t.whiteBright(C),
112
+ t.whiteBright(d),
113
+ t.whiteBright(m)
108
114
  );
115
+ s.add(l);
109
116
  }
117
+ const c = { ...a };
110
118
  if (p)
111
- for (const [o, s] of Object.entries(p)) {
112
- if (o === ".") {
113
- if (typeof s == "object" && s !== null) {
114
- const f = s;
115
- f.import && f.types && n && console.log("api-client-generator %s Found existing root export", e.blue("debug"));
116
- }
119
+ for (const [i, l] of Object.entries(p)) {
120
+ if (i === ".")
121
+ continue;
122
+ if (typeof l != "object" || l === null) {
123
+ r && console.log(
124
+ "api-client-generator %s Skipping malformed existing export value for key: %s",
125
+ t.yellow("warning"),
126
+ i
127
+ );
117
128
  continue;
118
129
  }
119
- const c = y(o);
120
- if (!c || i.has(c)) continue;
121
- const g = _(o);
122
- if (typeof s == "object" && s !== null) {
123
- const f = s;
124
- f.import && f.types && (a[g] = {
125
- import: _(f.import) + ".js",
126
- types: _(f.types) + ".d.ts"
127
- }, i.add(c), l.includes(c) || l.push(c), n && console.log(
128
- "api-client-generator %s Preserved custom export: %s",
129
- e.blue("debug"),
130
- e.whiteBright(g)
131
- ));
130
+ const g = l;
131
+ if (!g.import || !g.types) {
132
+ r && console.log(
133
+ "api-client-generator %s Skipping existing export with missing import/types for key: %s",
134
+ t.yellow("warning"),
135
+ i
136
+ );
137
+ continue;
132
138
  }
139
+ const d = A(i);
140
+ if (!(!d || d === "."))
141
+ if (P(d), d in a)
142
+ r && console.log(
143
+ "api-client-generator %s Existing export key '%s' was handled by new generation.",
144
+ t.blue("debug"),
145
+ t.whiteBright(d)
146
+ );
147
+ else {
148
+ const m = A(g.import), f = A(g.types);
149
+ c[d] = {
150
+ import: `${m}.js`,
151
+ types: `${f}.d.ts`
152
+ }, r && console.log(
153
+ "api-client-generator %s Preserved existing export: %s -> { import: %s, types: %s }",
154
+ t.blue("debug"),
155
+ t.whiteBright(d),
156
+ t.whiteBright(`${m}.js`),
157
+ t.whiteBright(`${f}.d.ts`)
158
+ );
159
+ }
133
160
  }
134
- if (l.length === 1) {
135
- const o = l[0], s = `./${r}/${o}.js`, c = `./${r}/types/${o}.d.ts`;
136
- a["."] = {
137
- import: s,
138
- types: c
139
- }, n && console.log(
140
- "api-client-generator %s Created root export for single module: %s",
141
- e.blue("debug"),
142
- e.whiteBright(o)
161
+ const n = /* @__PURE__ */ new Set();
162
+ for (const i in c) {
163
+ if (i === ".") continue;
164
+ const l = P(i);
165
+ l && n.add(l);
166
+ }
167
+ const h = Array.from(n);
168
+ if (h.length === 1) {
169
+ const i = h[0], l = `./${e}/${i}.js`, g = `./${e}/types/${i}.d.ts`;
170
+ c["."] = {
171
+ import: l,
172
+ types: g
173
+ }, r && console.log(
174
+ "api-client-generator %s Set root export for single module '%s': { import: %s, types: %s }",
175
+ t.blue("debug"),
176
+ t.whiteBright(i),
177
+ t.whiteBright(l),
178
+ t.whiteBright(g)
143
179
  );
144
180
  } else if (p && "." in p) {
145
- const o = p["."];
146
- if (o && typeof o == "object" && o.import) {
147
- const s = y(o.import);
148
- if (l.includes(s)) {
149
- const c = `./${r}/${s}.js`, g = `./${r}/types/${s}.d.ts`;
150
- a["."] = {
151
- import: c,
152
- types: g
153
- }, n && console.log(
154
- "api-client-generator %s Preserved existing root export pointing to module: %s",
155
- e.blue("debug"),
156
- e.whiteBright(s)
181
+ const i = p["."];
182
+ if (typeof i == "object" && i !== null) {
183
+ const l = i;
184
+ if (l.import && l.types) {
185
+ const g = P(l.import);
186
+ if (g && h.includes(g)) {
187
+ const d = `./${e}/${g}.js`, m = `./${e}/types/${g}.d.ts`;
188
+ c["."] = { import: d, types: m }, r && console.log(
189
+ "api-client-generator %s Preserved and standardized existing root export pointing to module '%s'",
190
+ t.blue("debug"),
191
+ t.whiteBright(g)
192
+ );
193
+ } else r && console.log(
194
+ "api-client-generator %s Removed existing root export as it pointed to an unknown or unhandled module '%s'",
195
+ t.yellow("warning"),
196
+ g || "unknown"
157
197
  );
158
- } else n && console.log(
159
- "api-client-generator %s Removed root export that pointed to non-existing module",
160
- e.yellow("warning")
161
- );
198
+ } else r && console.log("api-client-generator %s Removed malformed existing root export.", t.yellow("warning"));
162
199
  }
163
200
  }
164
- return a;
201
+ return c;
165
202
  }
166
- function $(t, r, p) {
167
- const n = p.VERBOSE ?? !1, a = p.APP_BUILD_DIR ?? "dist", i = [];
168
- a && i.push(a), i.push("package.json");
169
- const l = {
203
+ function N(o, e, p) {
204
+ const r = p.VERBOSE ?? !1, a = p.APP_BUILD_DIR ?? "dist", s = [];
205
+ a && s.push(a), s.push("package.json");
206
+ const c = {
170
207
  name: p.APP_PACKAGE_NAME || "api-client",
171
208
  version: p.APP_PACKAGE_VERSION || "1.0.0",
172
- files: i,
209
+ files: s,
173
210
  exports: {},
174
211
  // Add metadata to track generated content
175
212
  apiClientGenerator: {
@@ -177,13 +214,13 @@ function $(t, r, p) {
177
214
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
178
215
  }
179
216
  };
180
- let o = { ...l }, s, c, g;
181
- if (w(t))
217
+ let n = { ...c }, h, i, l;
218
+ if (_(o))
182
219
  try {
183
- const u = O(t, "utf-8");
220
+ const f = D(o, "utf-8");
184
221
  try {
185
- const d = JSON.parse(u);
186
- typeof d.module == "string" && (c = d.module), typeof d.types == "string" && (g = d.types), o = T(l, d, [
222
+ const u = JSON.parse(f);
223
+ typeof u.module == "string" && (i = u.module), typeof u.types == "string" && (l = u.types), n = O(c, u, [
187
224
  "name",
188
225
  "version",
189
226
  "description",
@@ -194,123 +231,122 @@ function $(t, r, p) {
194
231
  "scripts",
195
232
  "devDependencies",
196
233
  "dependencies"
197
- ]), d.files && Array.isArray(d.files) && (o.files = Array.from(/* @__PURE__ */ new Set([...i, ...d.files]))), s = d.exports, console.log("api-client-generator %s Updated existing package.json", e.greenBright("success"));
198
- } catch (d) {
234
+ ]), n.apiClientGenerator = c.apiClientGenerator, u.files && Array.isArray(u.files) && (n.files = Array.from(/* @__PURE__ */ new Set([...s, ...u.files]))), h = u.exports, console.log("api-client-generator %s Updated existing package.json", t.greenBright("success"));
235
+ } catch (u) {
199
236
  console.error(
200
237
  "api-client-generator %s Failed to parse existing package.json, creating new one",
201
- e.yellow("warning"),
202
- d
238
+ t.yellow("warning"),
239
+ u
203
240
  );
204
241
  }
205
- } catch (u) {
206
- console.error("api-client-generator %s Failed to read existing package.json", e.red("error"), u);
242
+ } catch (f) {
243
+ console.error("api-client-generator %s Failed to read existing package.json", t.red("error"), f);
207
244
  }
208
245
  else
209
- console.log("api-client-generator %s Creating new package.json", e.greenBright("success"));
210
- o.exports = F(r, a, s, n);
211
- const f = r.map(y).filter(Boolean);
212
- if (Array.from(new Set(f)).length === 1 && o.exports && "." in o.exports) {
213
- const u = o.exports["."];
214
- u && u.import && (o.module = u.import, n && console.log(
215
- "api-client-generator %s Set module field to: %s",
216
- e.blue("debug"),
217
- e.whiteBright(u.import)
218
- )), u && u.types && (o.types = u.types, n && console.log(
219
- "api-client-generator %s Set types field to: %s",
220
- e.blue("debug"),
221
- e.whiteBright(u.types)
246
+ console.log("api-client-generator %s Creating new package.json", t.greenBright("success"));
247
+ n.exports = U(e, a, h, r);
248
+ const g = Object.keys(n.exports), d = /* @__PURE__ */ new Set();
249
+ for (const f of g) {
250
+ if (f === ".") continue;
251
+ const u = P(f);
252
+ u && d.add(u);
253
+ }
254
+ if (Array.from(d).length, n.exports && "." in n.exports) {
255
+ const f = n.exports["."];
256
+ f && f.import && (n.module = f.import, r && console.log(
257
+ "api-client-generator %s Set 'module' field from root export: %s",
258
+ t.blue("debug"),
259
+ t.whiteBright(f.import)
260
+ )), f && f.types && (n.types = f.types, r && console.log(
261
+ "api-client-generator %s Set 'types' field from root export: %s",
262
+ t.blue("debug"),
263
+ t.whiteBright(f.types)
222
264
  ));
223
265
  } else
224
- "module" in o && (delete o.module, n && console.log(
225
- "api-client-generator %s Removed 'module' field from package.json as it conflicts with subpath exports",
226
- e.blue("debug")
227
- )), "types" in o && (delete o.types, n && console.log(
228
- "api-client-generator %s Removed 'types' field from package.json as it conflicts with subpath exports",
229
- e.blue("debug")
230
- ));
231
- return o;
266
+ "module" in n && (delete n.module, r && console.log("api-client-generator %s Removed 'module' field (no clear root export).", t.blue("debug"))), "types" in n && (delete n.types, r && console.log("api-client-generator %s Removed 'types' field (no clear root export).", t.blue("debug")));
267
+ return n;
232
268
  }
233
- async function U() {
234
- await j({}, "build");
235
- const t = L(process.argv.slice(2)), r = process.env.APP_PLATFORM_URL ?? t.APP_PLATFORM_URL, p = t.VERBOSE ?? !1;
236
- if (!r)
269
+ async function J() {
270
+ await T({}, "build");
271
+ const o = L(process.argv.slice(2)), e = process.env.APP_PLATFORM_URL ?? o.APP_PLATFORM_URL, p = o.VERBOSE ?? !1;
272
+ if (!e)
237
273
  return console.log(
238
- e.red("error"),
274
+ t.red("error"),
239
275
  "api-client-generator APP_PLATFORM_URL is required in .env config or as api-client-generator argument"
240
276
  );
241
- if (!t.APP_PLATFORM_MODULES)
242
- return console.log(e.red("error"), "api-client-generator modules command is required");
243
- if (!t.APP_API_CLIENT_DIRECTORY)
244
- return console.log(e.red("error"), "api-client-generator outDir command is required");
245
- const n = t.APP_OUT_DIR ?? "./", a = t.APP_BUILD_DIR ?? "dist", i = new k(t.APP_API_CLIENT_DIRECTORY);
246
- if (!w(t.APP_API_CLIENT_DIRECTORY))
277
+ if (!o.APP_PLATFORM_MODULES)
278
+ return console.log(t.red("error"), "api-client-generator modules command is required");
279
+ if (!o.APP_API_CLIENT_DIRECTORY)
280
+ return console.log(t.red("error"), "api-client-generator outDir command is required");
281
+ const r = o.APP_OUT_DIR ?? "./", a = o.APP_BUILD_DIR ?? "dist", s = new $(o.APP_API_CLIENT_DIRECTORY);
282
+ if (!_(o.APP_API_CLIENT_DIRECTORY))
247
283
  try {
248
- I(t.APP_API_CLIENT_DIRECTORY, { recursive: !0 }), console.log(
284
+ I(o.APP_API_CLIENT_DIRECTORY, { recursive: !0 }), console.log(
249
285
  "api-client-generator %s Created directory %s",
250
- e.greenBright("success"),
251
- e.whiteBright(t.APP_API_CLIENT_DIRECTORY)
286
+ t.greenBright("success"),
287
+ t.whiteBright(o.APP_API_CLIENT_DIRECTORY)
252
288
  );
253
- } catch (c) {
289
+ } catch (i) {
254
290
  console.error(
255
291
  "api-client-generator %s Failed to create directory %s",
256
- e.red("error"),
257
- e.whiteBright(t.APP_API_CLIENT_DIRECTORY),
258
- c
292
+ t.red("error"),
293
+ t.whiteBright(o.APP_API_CLIENT_DIRECTORY),
294
+ i
259
295
  );
260
296
  return;
261
297
  }
262
- const l = h.join(t.APP_API_CLIENT_DIRECTORY, a);
263
- if (!w(l))
298
+ const c = y.join(o.APP_API_CLIENT_DIRECTORY, a);
299
+ if (!_(c))
264
300
  try {
265
- I(l, { recursive: !0 }), console.log(
301
+ I(c, { recursive: !0 }), console.log(
266
302
  "api-client-generator %s Created build directory %s",
267
- e.greenBright("success"),
268
- e.whiteBright(l)
303
+ t.greenBright("success"),
304
+ t.whiteBright(c)
269
305
  );
270
- } catch (c) {
306
+ } catch (i) {
271
307
  console.error(
272
308
  "api-client-generator %s Failed to create build directory %s",
273
- e.red("error"),
274
- e.whiteBright(l),
275
- c
309
+ t.red("error"),
310
+ t.whiteBright(c),
311
+ i
276
312
  );
277
313
  }
278
- const o = t.APP_PLATFORM_MODULES.replace(/[[\]]/g, "").split(","), s = [];
279
- for (const c of o) {
280
- const g = i.resolveApiClientPaths(c);
314
+ const n = o.APP_PLATFORM_MODULES.replace(/[[\]]/g, "").split(","), h = [];
315
+ for (const i of n) {
316
+ const l = s.resolveApiClientPaths(i);
281
317
  console.log(
282
318
  "api-client-generator %s Generating API client for %s module on %s environment",
283
- e.green("info"),
284
- e.whiteBright(c),
285
- e.whiteBright(r)
319
+ t.green("info"),
320
+ t.whiteBright(i),
321
+ t.whiteBright(e)
286
322
  );
287
- const f = [
323
+ const g = [
288
324
  "run",
289
- i.nswagPaths.configuration,
290
- `/variables:APP_PLATFORM_URL=${r},APP_PLATFORM_MODULE=${c},APP_AUTH_API_BASE_PATH=${i.nswagPaths.authApiBase},APP_TEMPLATE_DIRECTORY=${i.nswagPaths.templates},APP_API_CLIENT_PATH=${g.nswag}`,
325
+ s.nswagPaths.configuration,
326
+ `/variables:APP_PLATFORM_URL=${e},APP_PLATFORM_MODULE=${i},APP_AUTH_API_BASE_PATH=${s.nswagPaths.authApiBase},APP_TEMPLATE_DIRECTORY=${s.nswagPaths.templates},APP_API_CLIENT_PATH=${l.nswag}`,
291
327
  "/runtime:Net60"
292
328
  ];
293
- p && console.log("api-client-generator %s Running command: npx nswag %s", e.blue("debug"), f.join(" ")), D("npx nswag", f, {
329
+ p && console.log("api-client-generator %s Running command: npx nswag %s", t.blue("debug"), g.join(" ")), E("npx nswag", g, {
294
330
  stdio: ["ignore", "inherit", "ignore"],
295
331
  shell: !0
296
332
  }).status === 0 ? (console.log(
297
333
  "api-client-generator %s Successfully generated %s",
298
- e.greenBright("success"),
299
- e.whiteBright(g.console)
300
- ), t.SKIP_BUILD || s.push(`${c.toLowerCase()}.ts`)) : console.error(
334
+ t.greenBright("success"),
335
+ t.whiteBright(l.console)
336
+ ), o.SKIP_BUILD || h.push(`${i.toLowerCase()}.ts`)) : console.error(
301
337
  "api-client-generator %s Failed to generate %s",
302
- e.red("error"),
303
- e.whiteBright(g.console)
338
+ t.red("error"),
339
+ t.whiteBright(l.console)
304
340
  );
305
341
  }
306
- if (!t.SKIP_BUILD) {
307
- const c = h.join(t.APP_API_CLIENT_DIRECTORY, "tsconfig.json"), g = M(c, s, n, a);
308
- R(c, JSON.stringify(g, null, 2)), console.log("api-client-generator %s Compiling TypeScript files to JavaScript", e.green("info")), D("npx tsc", ["--project", c], {
342
+ if (!o.SKIP_BUILD) {
343
+ const i = y.join(o.APP_API_CLIENT_DIRECTORY, "tsconfig.json"), l = v(i, h, r, a);
344
+ B(i, JSON.stringify(l, null, 2)), console.log("api-client-generator %s Compiling TypeScript files to JavaScript", t.green("info")), E("npx tsc", ["--project", i], {
309
345
  stdio: ["ignore", "inherit", "ignore"],
310
346
  shell: !0
311
- }).status === 0 ? console.log("api-client-generator %s Successfully compiled TypeScript files", e.greenBright("success")) : console.error("api-client-generator %s Failed to compile TypeScript files", e.red("error"));
312
- const m = h.join(t.APP_API_CLIENT_DIRECTORY, "package.json"), P = $(m, s, t);
313
- R(m, JSON.stringify(P, null, 2)), console.log("api-client-generator %s Generated package.json", e.greenBright("success"));
347
+ }).status === 0 ? console.log("api-client-generator %s Successfully compiled TypeScript files", t.greenBright("success")) : console.error("api-client-generator %s Failed to compile TypeScript files", t.red("error"));
348
+ const d = y.join(o.APP_API_CLIENT_DIRECTORY, "package.json"), m = N(d, h, o);
349
+ B(d, JSON.stringify(m, null, 2)), console.log("api-client-generator %s Generated package.json", t.greenBright("success"));
314
350
  }
315
351
  }
316
- U();
352
+ J();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vc-shell/api-client-generator",
3
3
  "description": "Tool for API clients generation",
4
- "version": "1.1.10",
4
+ "version": "1.1.11",
5
5
  "type": "module",
6
6
  "bin": "./dist/api-client-generator.js",
7
7
  "files": [
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/cross-spawn": "^6.0.6",
16
- "@vc-shell/ts-config": "^1.1.10",
16
+ "@vc-shell/ts-config": "^1.1.11",
17
17
  "typescript": "^5.8.3"
18
18
  },
19
19
  "dependencies": {