@vc-shell/api-client-generator 2.0.0-alpha.23 → 2.0.0-alpha.25
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 +10 -0
- package/dist/api-client-generator.js +118 -78
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# [2.0.0-alpha.25](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2026-03-25)
|
|
2
|
+
|
|
3
|
+
**Note:** Version bump only for package @vc-shell/api-client-generator
|
|
4
|
+
|
|
5
|
+
# [2.0.0-alpha.24](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2026-03-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **api-client, migrate:** default to Interface for new API clients, add nswag class-to-interface migration ([569a1f7](https://github.com/VirtoCommerce/vc-shell/commit/569a1f79532d5ca2e1a9968e3b249b3d3ffeed71))
|
|
1
11
|
# [2.0.0-alpha.23](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2026-03-23)
|
|
2
12
|
|
|
3
13
|
**Note:** Version bump only for package @vc-shell/api-client-generator
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import e from "chalk";
|
|
2
|
-
import { sync as
|
|
3
|
-
import { resolveConfig as
|
|
4
|
-
import { existsSync as
|
|
5
|
-
import m, { dirname as
|
|
6
|
-
import { fileURLToPath as
|
|
7
|
-
import { cwd as
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
class
|
|
2
|
+
import { sync as v } from "cross-spawn";
|
|
3
|
+
import { resolveConfig as j } from "vite";
|
|
4
|
+
import { existsSync as w, mkdirSync as I, writeFileSync as T, readdirSync as O, readFileSync as x } from "node:fs";
|
|
5
|
+
import m, { dirname as N, resolve as B, join as b, relative as S } from "node:path";
|
|
6
|
+
import { fileURLToPath as L } from "node:url";
|
|
7
|
+
import { cwd as M } from "node:process";
|
|
8
|
+
import U from "mri";
|
|
9
|
+
const $ = L(import.meta.url), F = N($);
|
|
10
|
+
class V {
|
|
11
11
|
workingDirectory;
|
|
12
12
|
generatorDirectory;
|
|
13
13
|
assetsDirectory;
|
|
14
14
|
apiClientDirectory;
|
|
15
15
|
nswagPaths;
|
|
16
16
|
constructor(r) {
|
|
17
|
-
this.workingDirectory =
|
|
18
|
-
configuration: b(
|
|
17
|
+
this.workingDirectory = M(), this.generatorDirectory = B(F, ".."), this.assetsDirectory = b(this.generatorDirectory, "public", "assets"), this.apiClientDirectory = B(this.workingDirectory, r), this.nswagPaths = {
|
|
18
|
+
configuration: b(S(this.workingDirectory, this.assetsDirectory), "config.nswag"),
|
|
19
19
|
authApiBase: "authApiBase.ts",
|
|
20
20
|
templates: "templates"
|
|
21
21
|
};
|
|
@@ -24,12 +24,12 @@ class U {
|
|
|
24
24
|
const n = `${r.toLowerCase()}.ts`;
|
|
25
25
|
return {
|
|
26
26
|
fileName: n,
|
|
27
|
-
nswag: b(
|
|
28
|
-
console: b(
|
|
27
|
+
nswag: b(S(this.assetsDirectory, this.apiClientDirectory), n),
|
|
28
|
+
console: b(S(this.workingDirectory, this.apiClientDirectory), n)
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function D(o, r, n = []) {
|
|
33
33
|
const t = { ...o };
|
|
34
34
|
for (const i of n)
|
|
35
35
|
i in r && (t[i] = r[i]);
|
|
@@ -39,7 +39,7 @@ function v(o, r, n = []) {
|
|
|
39
39
|
}
|
|
40
40
|
return t;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function G(o, r, n, t) {
|
|
43
43
|
const i = {
|
|
44
44
|
extends: "@vc-shell/ts-config/tsconfig.json",
|
|
45
45
|
compilerOptions: {
|
|
@@ -52,12 +52,12 @@ function $(o, r, n, t) {
|
|
|
52
52
|
include: ["*.ts"]
|
|
53
53
|
};
|
|
54
54
|
let s = { ...i };
|
|
55
|
-
if (
|
|
55
|
+
if (w(o))
|
|
56
56
|
try {
|
|
57
|
-
const a =
|
|
57
|
+
const a = x(o, "utf-8");
|
|
58
58
|
try {
|
|
59
59
|
const l = JSON.parse(a);
|
|
60
|
-
s =
|
|
60
|
+
s = D(i, l), l.compilerOptions && typeof l.compilerOptions == "object" && (s.compilerOptions = {
|
|
61
61
|
...i.compilerOptions,
|
|
62
62
|
...l.compilerOptions
|
|
63
63
|
}, s.compilerOptions.outDir = t, s.compilerOptions.declarationDir = m.join(t, "types"));
|
|
@@ -109,10 +109,10 @@ function _(o) {
|
|
|
109
109
|
fullName: n
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function R(o) {
|
|
113
113
|
return _(o).coreName;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function K(o, r) {
|
|
116
116
|
if (!o)
|
|
117
117
|
return [];
|
|
118
118
|
const n = [`./${o}`];
|
|
@@ -121,19 +121,19 @@ function F(o, r) {
|
|
|
121
121
|
function P(o) {
|
|
122
122
|
return o.replace(/\\/g, "/");
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Y(o, r, n, t) {
|
|
125
125
|
const i = {}, s = /* @__PURE__ */ new Set();
|
|
126
126
|
for (const d of o) {
|
|
127
127
|
const g = _(d);
|
|
128
128
|
if (!g.coreName) continue;
|
|
129
|
-
const
|
|
130
|
-
for (const
|
|
131
|
-
i[
|
|
129
|
+
const y = g.fullName, c = P(`./${m.join(r, `${y}.js`)}`), h = P(`./${m.join(r, "types", `${y}.d.ts`)}`), u = { import: c, types: h }, f = K(g.coreName, g.prefix);
|
|
130
|
+
for (const A of f)
|
|
131
|
+
i[A] = u, t && console.log(
|
|
132
132
|
"api-client-generator %s Generated standard export: %s -> { import: %s, types: %s }",
|
|
133
133
|
e.blue("debug"),
|
|
134
|
-
e.whiteBright(
|
|
134
|
+
e.whiteBright(A),
|
|
135
135
|
e.whiteBright(c),
|
|
136
|
-
e.whiteBright(
|
|
136
|
+
e.whiteBright(h)
|
|
137
137
|
);
|
|
138
138
|
s.add(g.coreName);
|
|
139
139
|
}
|
|
@@ -150,8 +150,8 @@ function V(o, r, n, t) {
|
|
|
150
150
|
);
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
if (!
|
|
153
|
+
const y = g;
|
|
154
|
+
if (!y.import || !y.types) {
|
|
155
155
|
t && console.log(
|
|
156
156
|
"api-client-generator %s Skipping existing export with missing import/types for key: %s",
|
|
157
157
|
e.yellow("warning"),
|
|
@@ -161,22 +161,22 @@ function V(o, r, n, t) {
|
|
|
161
161
|
}
|
|
162
162
|
const c = E(d);
|
|
163
163
|
if (!(!c || c === "."))
|
|
164
|
-
if (
|
|
164
|
+
if (R(c), c in i)
|
|
165
165
|
t && console.log(
|
|
166
166
|
"api-client-generator %s Existing export key '%s' was handled by new generation.",
|
|
167
167
|
e.blue("debug"),
|
|
168
168
|
e.whiteBright(c)
|
|
169
169
|
);
|
|
170
170
|
else {
|
|
171
|
-
const
|
|
171
|
+
const h = E(y.import), u = E(y.types);
|
|
172
172
|
a[c] = {
|
|
173
|
-
import: P(`${
|
|
173
|
+
import: P(`${h}.js`),
|
|
174
174
|
types: P(`${u}.d.ts`)
|
|
175
175
|
}, t && console.log(
|
|
176
176
|
"api-client-generator %s Preserved existing export: %s -> { import: %s, types: %s }",
|
|
177
177
|
e.blue("debug"),
|
|
178
178
|
e.whiteBright(c),
|
|
179
|
-
e.whiteBright(`${
|
|
179
|
+
e.whiteBright(`${h}.js`),
|
|
180
180
|
e.whiteBright(`${u}.d.ts`)
|
|
181
181
|
);
|
|
182
182
|
}
|
|
@@ -189,15 +189,15 @@ function V(o, r, n, t) {
|
|
|
189
189
|
}
|
|
190
190
|
const p = Array.from(l.keys());
|
|
191
191
|
if (p.length === 1) {
|
|
192
|
-
const d = p[0], g = l.get(d),
|
|
192
|
+
const d = p[0], g = l.get(d), y = P(`./${m.join(r, `${g}.js`)}`), c = P(`./${m.join(r, "types", `${g}.d.ts`)}`);
|
|
193
193
|
a["."] = {
|
|
194
|
-
import:
|
|
194
|
+
import: y,
|
|
195
195
|
types: c
|
|
196
196
|
}, t && console.log(
|
|
197
197
|
"api-client-generator %s Set root export for single module '%s': { import: %s, types: %s }",
|
|
198
198
|
e.blue("debug"),
|
|
199
199
|
e.whiteBright(g),
|
|
200
|
-
e.whiteBright(
|
|
200
|
+
e.whiteBright(y),
|
|
201
201
|
e.whiteBright(c)
|
|
202
202
|
);
|
|
203
203
|
} else if (n && "." in n) {
|
|
@@ -207,11 +207,11 @@ function V(o, r, n, t) {
|
|
|
207
207
|
if (g.import && g.types) {
|
|
208
208
|
const c = _(g.import).coreName;
|
|
209
209
|
if (c && p.includes(c)) {
|
|
210
|
-
const
|
|
210
|
+
const h = l.get(c), u = P(`./${m.join(r, `${h}.js`)}`), f = P(`./${m.join(r, "types", `${h}.d.ts`)}`);
|
|
211
211
|
a["."] = { import: u, types: f }, t && console.log(
|
|
212
212
|
"api-client-generator %s Preserved and standardized existing root export pointing to module '%s'",
|
|
213
213
|
e.blue("debug"),
|
|
214
|
-
e.whiteBright(
|
|
214
|
+
e.whiteBright(h)
|
|
215
215
|
);
|
|
216
216
|
} else t && console.log(
|
|
217
217
|
"api-client-generator %s Removed existing root export as it pointed to an unknown or unhandled module '%s'",
|
|
@@ -223,7 +223,7 @@ function V(o, r, n, t) {
|
|
|
223
223
|
}
|
|
224
224
|
return a;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function J(o, r, n) {
|
|
227
227
|
const t = n.VERBOSE ?? !1, i = n.APP_BUILD_DIR ?? "dist", s = [];
|
|
228
228
|
i && s.push(i), s.push("package.json");
|
|
229
229
|
const a = {
|
|
@@ -238,12 +238,12 @@ function G(o, r, n) {
|
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
240
|
let l = { ...a }, p, d, g;
|
|
241
|
-
if (
|
|
241
|
+
if (w(o))
|
|
242
242
|
try {
|
|
243
|
-
const u =
|
|
243
|
+
const u = x(o, "utf-8");
|
|
244
244
|
try {
|
|
245
245
|
const f = JSON.parse(u);
|
|
246
|
-
typeof f.module == "string" && (d = f.module), typeof f.types == "string" && (g = f.types), l =
|
|
246
|
+
typeof f.module == "string" && (d = f.module), typeof f.types == "string" && (g = f.types), l = D(a, f, [
|
|
247
247
|
"name",
|
|
248
248
|
"version",
|
|
249
249
|
"description",
|
|
@@ -267,11 +267,11 @@ function G(o, r, n) {
|
|
|
267
267
|
}
|
|
268
268
|
else
|
|
269
269
|
console.log("api-client-generator %s Creating new package.json", e.greenBright("success"));
|
|
270
|
-
l.exports =
|
|
271
|
-
const
|
|
272
|
-
for (const u of
|
|
270
|
+
l.exports = Y(r, i, p, t);
|
|
271
|
+
const y = Object.keys(l.exports), c = /* @__PURE__ */ new Set();
|
|
272
|
+
for (const u of y) {
|
|
273
273
|
if (u === ".") continue;
|
|
274
|
-
const f =
|
|
274
|
+
const f = R(u);
|
|
275
275
|
f && c.add(f);
|
|
276
276
|
}
|
|
277
277
|
if (Array.from(c).length, l.exports && "." in l.exports) {
|
|
@@ -289,18 +289,58 @@ function G(o, r, n) {
|
|
|
289
289
|
"module" in l && (delete l.module, t && console.log("api-client-generator %s Removed 'module' field (no clear root export).", e.blue("debug"))), "types" in l && (delete l.types, t && console.log("api-client-generator %s Removed 'types' field (no clear root export).", e.blue("debug")));
|
|
290
290
|
return l;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
const
|
|
294
|
-
|
|
292
|
+
function W(o) {
|
|
293
|
+
const r = m.resolve(process.cwd(), o);
|
|
294
|
+
if (!w(r))
|
|
295
|
+
return;
|
|
296
|
+
let n;
|
|
297
|
+
try {
|
|
298
|
+
n = O(r).filter((t) => t.endsWith(".ts") && t !== "index.ts");
|
|
299
|
+
} catch {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
if (n.length !== 0) {
|
|
303
|
+
for (const t of n.slice(0, 5)) {
|
|
304
|
+
const i = m.join(r, t);
|
|
305
|
+
try {
|
|
306
|
+
const s = x(i, "utf-8");
|
|
307
|
+
if (/export class \w+ implements I\w+/.test(s))
|
|
308
|
+
return "Class";
|
|
309
|
+
} catch {
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return "Interface";
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function q() {
|
|
317
|
+
const o = U(process.argv.slice(2)), r = process.env.APP_PLATFORM_URL ?? o.APP_PLATFORM_URL, n = r?.endsWith("/") ? r : r && `${r}/`, t = process.env.APP_PLATFORM_MODULES ?? o.APP_PLATFORM_MODULES, i = process.env.APP_API_CLIENT_DIRECTORY ?? o.APP_API_CLIENT_DIRECTORY, s = process.env.APP_PACKAGE_NAME ?? o.APP_PACKAGE_NAME, a = process.env.APP_PACKAGE_VERSION ?? o.APP_PACKAGE_VERSION, l = process.env.APP_OUT_DIR ?? o.APP_OUT_DIR ?? "./", p = process.env.APP_BUILD_DIR ?? o.APP_BUILD_DIR ?? "dist", d = process.env.RUNTIME ?? o.RUNTIME ?? "Net80", g = process.env.SKIP_BUILD === "true" || o.SKIP_BUILD === !0, y = process.env.VERBOSE === "true" || o.VERBOSE === !0, c = process.env.APP_TYPE_STYLE ?? o.APP_TYPE_STYLE;
|
|
318
|
+
let h;
|
|
319
|
+
c ? h = c : i ? h = W(i) ?? "Interface" : h = "Interface", c || console.log(
|
|
320
|
+
"api-client-generator %s APP_TYPE_STYLE not specified, using %s (set APP_TYPE_STYLE=Class to generate class-based DTOs)",
|
|
321
|
+
e.blue("info"),
|
|
322
|
+
e.whiteBright(h)
|
|
323
|
+
);
|
|
324
|
+
const u = process.env.APP_PACKAGE_MODE === "true" || o.PACKAGE === !0, f = ["Net80", "Net90", "Net100"];
|
|
325
|
+
if (f.includes(d) || console.warn(
|
|
295
326
|
"api-client-generator %s Unknown RUNTIME value: %s. Known values: %s. Proceeding anyway — NSwag will report an error if the runtime is unsupported.",
|
|
296
327
|
e.yellow("warning"),
|
|
297
328
|
e.whiteBright(d),
|
|
298
|
-
e.whiteBright(
|
|
299
|
-
),
|
|
329
|
+
e.whiteBright(f.join(", "))
|
|
330
|
+
), h !== "Class" && h !== "Interface" && (console.error(
|
|
300
331
|
"api-client-generator %s Invalid APP_TYPE_STYLE value: %s. Must be either 'Class' or 'Interface'",
|
|
301
332
|
e.red("error"),
|
|
302
|
-
e.whiteBright(
|
|
303
|
-
), process.exit(1)),
|
|
333
|
+
e.whiteBright(h)
|
|
334
|
+
), process.exit(1)), y) {
|
|
335
|
+
const k = c ? "explicit" : i ? "auto-detected" : "default";
|
|
336
|
+
console.log(
|
|
337
|
+
"api-client-generator %s Using APP_TYPE_STYLE: %s (%s)",
|
|
338
|
+
e.blue("debug"),
|
|
339
|
+
e.whiteBright(h),
|
|
340
|
+
e.gray(k)
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
n || (console.error(
|
|
304
344
|
"api-client-generator %s APP_PLATFORM_URL is required in .env config or as api-client-generator argument",
|
|
305
345
|
e.red("error")
|
|
306
346
|
), process.exit(1)), t || (console.error(
|
|
@@ -310,13 +350,13 @@ function K() {
|
|
|
310
350
|
"api-client-generator %s APP_API_CLIENT_DIRECTORY is required in .env config or as api-client-generator argument",
|
|
311
351
|
e.red("error")
|
|
312
352
|
), process.exit(1));
|
|
313
|
-
const
|
|
314
|
-
return
|
|
353
|
+
const A = m.join(m.resolve(process.cwd(), i), "package.json"), C = u || w(A);
|
|
354
|
+
return y && console.log(
|
|
315
355
|
"api-client-generator %s Package mode: %s (explicit flag: %s, existing package.json: %s)",
|
|
316
356
|
e.blue("debug"),
|
|
317
|
-
e.whiteBright(String(
|
|
318
|
-
e.whiteBright(String(
|
|
319
|
-
e.whiteBright(String(A
|
|
357
|
+
e.whiteBright(String(C)),
|
|
358
|
+
e.whiteBright(String(u)),
|
|
359
|
+
e.whiteBright(String(w(A)))
|
|
320
360
|
), {
|
|
321
361
|
platformUrl: n,
|
|
322
362
|
platformModules: t,
|
|
@@ -327,17 +367,17 @@ function K() {
|
|
|
327
367
|
buildDir: p,
|
|
328
368
|
runtime: d,
|
|
329
369
|
skipBuild: g,
|
|
330
|
-
verbose:
|
|
331
|
-
typeStyle:
|
|
332
|
-
packageMode:
|
|
370
|
+
verbose: y,
|
|
371
|
+
typeStyle: h,
|
|
372
|
+
packageMode: C,
|
|
333
373
|
parsedArgs: o
|
|
334
374
|
};
|
|
335
375
|
}
|
|
336
|
-
function
|
|
337
|
-
const r = new
|
|
338
|
-
if (!
|
|
376
|
+
function z(o) {
|
|
377
|
+
const r = new V(o.apiClientDirectory);
|
|
378
|
+
if (!w(o.apiClientDirectory))
|
|
339
379
|
try {
|
|
340
|
-
|
|
380
|
+
I(o.apiClientDirectory, { recursive: !0 }), console.log(
|
|
341
381
|
"api-client-generator %s Created directory %s",
|
|
342
382
|
e.greenBright("success"),
|
|
343
383
|
e.whiteBright(o.apiClientDirectory)
|
|
@@ -368,7 +408,7 @@ function Y(o) {
|
|
|
368
408
|
`RUNTIME=${o.runtime}`
|
|
369
409
|
].join(","), l = ["run", r.nswagPaths.configuration, `/variables:${a}`];
|
|
370
410
|
o.verbose && (console.log("api-client-generator %s Running command: npx nswag %s", e.blue("debug"), l.join(" ")), console.log("api-client-generator %s Variables: %s", e.blue("debug"), a));
|
|
371
|
-
const p =
|
|
411
|
+
const p = v("npx nswag", l, {
|
|
372
412
|
stdio: ["ignore", o.verbose ? "inherit" : "pipe", "inherit"],
|
|
373
413
|
shell: !0
|
|
374
414
|
});
|
|
@@ -388,11 +428,11 @@ function Y(o) {
|
|
|
388
428
|
}
|
|
389
429
|
return t;
|
|
390
430
|
}
|
|
391
|
-
function
|
|
431
|
+
function H(o, r) {
|
|
392
432
|
const n = m.join(o.apiClientDirectory, o.buildDir);
|
|
393
|
-
if (!
|
|
433
|
+
if (!w(n))
|
|
394
434
|
try {
|
|
395
|
-
|
|
435
|
+
I(n, { recursive: !0 }), console.log(
|
|
396
436
|
"api-client-generator %s Created build directory %s",
|
|
397
437
|
e.greenBright("success"),
|
|
398
438
|
e.whiteBright(n)
|
|
@@ -404,19 +444,19 @@ function J(o, r) {
|
|
|
404
444
|
e.whiteBright(n)
|
|
405
445
|
), console.error(e.red("Error details:"), p), console.error("api-client-generator %s Build directory creation troubleshooting:", e.blue("info")), console.error(e.blue(" - Check if you have write permissions in the API client directory")), console.error(e.blue(" - Ensure the build directory path is valid")), console.error(e.blue(" - The TypeScript compiler will attempt to create the directory during compilation"));
|
|
406
446
|
}
|
|
407
|
-
const t = m.join(o.apiClientDirectory, "tsconfig.json"), i =
|
|
447
|
+
const t = m.join(o.apiClientDirectory, "tsconfig.json"), i = G(t, r, o.outDir, o.buildDir);
|
|
408
448
|
try {
|
|
409
|
-
|
|
449
|
+
T(t, JSON.stringify(i, null, 2)), o.verbose && console.log("api-client-generator %s Updated tsconfig.json", e.greenBright("success"));
|
|
410
450
|
} catch (p) {
|
|
411
451
|
console.error("api-client-generator %s Failed to write tsconfig.json", e.red("error")), console.error(e.red("Error details:"), p), console.error("api-client-generator %s File writing troubleshooting:", e.blue("info")), console.error(e.blue(" - Check if you have write permissions in the API client directory")), console.error(e.blue(" - Ensure the file path is valid and not locked by another process")), console.error(e.blue(" - Try running with elevated permissions if needed")), process.exit(1);
|
|
412
452
|
}
|
|
413
453
|
console.log("api-client-generator %s Compiling TypeScript files to JavaScript", e.green("info"));
|
|
414
|
-
const s =
|
|
454
|
+
const s = v("npx tsc", ["--project", t], {
|
|
415
455
|
stdio: ["ignore", "pipe", "pipe"],
|
|
416
456
|
shell: !0
|
|
417
457
|
});
|
|
418
458
|
s.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")), s.stderr && s.stderr.toString().trim() && (console.error("api-client-generator %s TypeScript compilation errors:", e.red("error")), console.error(e.red(s.stderr.toString()))), s.stdout && s.stdout.toString().trim() && (console.error("api-client-generator %s TypeScript output:", e.yellow("warning")), console.error(e.yellow(s.stdout.toString()))), console.error("api-client-generator %s TypeScript compilation troubleshooting:", e.blue("info")), console.error(e.blue(" - Check if all required dependencies are installed")), console.error(e.blue(" - Verify TypeScript configuration in tsconfig.json")), console.error(e.blue(" - Ensure generated API files are valid TypeScript")), console.error(e.blue(" - Try running with --VERBOSE=true for more details")), process.exit(1));
|
|
419
|
-
const a = m.join(o.apiClientDirectory, "package.json"), l =
|
|
459
|
+
const a = m.join(o.apiClientDirectory, "package.json"), l = J(a, r, {
|
|
420
460
|
...o.parsedArgs,
|
|
421
461
|
APP_PACKAGE_NAME: o.packageName,
|
|
422
462
|
APP_PACKAGE_VERSION: o.packageVersion,
|
|
@@ -424,16 +464,16 @@ function J(o, r) {
|
|
|
424
464
|
VERBOSE: o.verbose
|
|
425
465
|
});
|
|
426
466
|
try {
|
|
427
|
-
|
|
467
|
+
T(a, JSON.stringify(l, null, 2)), console.log("api-client-generator %s Generated package.json", e.greenBright("success"));
|
|
428
468
|
} catch (p) {
|
|
429
469
|
console.error("api-client-generator %s Failed to write package.json", e.red("error")), console.error(e.red("Error details:"), p), console.error("api-client-generator %s Package.json writing troubleshooting:", e.blue("info")), console.error(e.blue(" - Check if you have write permissions in the API client directory")), console.error(e.blue(" - Ensure the file path is valid and not locked by another process")), console.error(e.blue(" - Try running with elevated permissions if needed")), process.exit(1);
|
|
430
470
|
}
|
|
431
471
|
}
|
|
432
|
-
async function
|
|
472
|
+
async function Q() {
|
|
433
473
|
try {
|
|
434
|
-
await
|
|
435
|
-
const o =
|
|
436
|
-
o.packageMode && !o.skipBuild && r.length > 0 ?
|
|
474
|
+
await j({}, "build");
|
|
475
|
+
const o = q(), r = z(o);
|
|
476
|
+
o.packageMode && !o.skipBuild && r.length > 0 ? H(o, r) : o.packageMode || console.log(
|
|
437
477
|
"api-client-generator %s Generated %d API client file(s) in simple mode (no package build)",
|
|
438
478
|
e.greenBright("success"),
|
|
439
479
|
r.length
|
|
@@ -442,4 +482,4 @@ async function q() {
|
|
|
442
482
|
console.error("api-client-generator %s Unexpected error occurred during API client generation", e.red("error")), console.error(e.red("Error details:"), o), console.error("api-client-generator %s General troubleshooting:", e.blue("info")), console.error(e.blue(" - Check if all required dependencies are installed")), console.error(e.blue(" - Ensure you have proper permissions")), console.error(e.blue(" - Try running with --VERBOSE=true for more details")), console.error(e.blue(" - Check the platform URL and module names")), process.exit(1);
|
|
443
483
|
}
|
|
444
484
|
}
|
|
445
|
-
|
|
485
|
+
Q();
|
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": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.25",
|
|
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": "2.0.0-alpha.
|
|
16
|
+
"@vc-shell/ts-config": "2.0.0-alpha.25",
|
|
17
17
|
"typescript": "^5.8.3"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|