api-core-lib 12.12.100 → 12.12.102
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/dist/cli.cjs +16 -28
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -9,10 +9,6 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
9
9
|
var __commonJS = (cb, mod) => function __require() {
|
|
10
10
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
11
|
};
|
|
12
|
-
var __export = (target, all) => {
|
|
13
|
-
for (var name in all)
|
|
14
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
|
-
};
|
|
16
12
|
var __copyProps = (to, from, except, desc) => {
|
|
17
13
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
14
|
for (let key of __getOwnPropNames(from))
|
|
@@ -29,7 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
26
|
mod
|
|
31
27
|
));
|
|
32
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
28
|
|
|
34
29
|
// node_modules/openapi-types/dist/index.js
|
|
35
30
|
var require_dist = __commonJS({
|
|
@@ -68,16 +63,10 @@ var require_dist = __commonJS({
|
|
|
68
63
|
});
|
|
69
64
|
|
|
70
65
|
// src/cli.ts
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
runGenerator: () => runGenerator,
|
|
76
|
-
sanitizeForModuleName: () => sanitizeForModuleName,
|
|
77
|
-
toCamelCase: () => toCamelCase,
|
|
78
|
-
toPascalCase: () => toPascalCase
|
|
79
|
-
});
|
|
80
|
-
module.exports = __toCommonJS(cli_exports);
|
|
66
|
+
var import_commander = require("commander");
|
|
67
|
+
var import_path2 = __toESM(require("path"), 1);
|
|
68
|
+
|
|
69
|
+
// src/generator/v1.ts
|
|
81
70
|
var import_fs = __toESM(require("fs"), 1);
|
|
82
71
|
var import_path = __toESM(require("path"), 1);
|
|
83
72
|
var import_util = __toESM(require("util"), 1);
|
|
@@ -85,7 +74,7 @@ var import_chalk = __toESM(require("chalk"), 1);
|
|
|
85
74
|
var import_dotenv = __toESM(require("dotenv"), 1);
|
|
86
75
|
var import_swagger_parser = __toESM(require("@apidevtools/swagger-parser"), 1);
|
|
87
76
|
var import_openapi_types = __toESM(require_dist(), 1);
|
|
88
|
-
var
|
|
77
|
+
var inquirer = __toESM(require("inquirer"), 1);
|
|
89
78
|
var DEBUG_MODE = process.env.DEBUG === "true";
|
|
90
79
|
var debugLog = (title, data) => DEBUG_MODE && console.log(import_chalk.default.yellow(`
|
|
91
80
|
[DEBUG: ${title}]`), import_util.default.inspect(data, { depth: 5, colors: true }));
|
|
@@ -240,7 +229,7 @@ async function generateModuleFiles(module2, allSchemas, allEnums, outputDir) {
|
|
|
240
229
|
Generating module: ${import_chalk.default.bold(module2.moduleName)}`));
|
|
241
230
|
console.log(import_chalk.default.gray(` \u2713 (Simulated) Generated files for ${module2.moduleName}.`));
|
|
242
231
|
}
|
|
243
|
-
async function
|
|
232
|
+
async function runGeneratorV1(options) {
|
|
244
233
|
console.log(import_chalk.default.cyan.bold("\u{1F680} Starting API Development Platform Generator (Godfather Interactive Edition)..."));
|
|
245
234
|
import_dotenv.default.config({ path: options.envPath });
|
|
246
235
|
const specUrl = process.env.OPENAPI_SPEC_URL || "./swagger.json";
|
|
@@ -257,7 +246,7 @@ async function runGenerator(options) {
|
|
|
257
246
|
if (import_fs.default.existsSync(outputDir)) {
|
|
258
247
|
console.log(import_chalk.default.yellow.bold(`
|
|
259
248
|
\u26A0\uFE0F An existing generation has been found at: ${outputDir}`));
|
|
260
|
-
const { action } = await
|
|
249
|
+
const { action } = await inquirer.prompt([{
|
|
261
250
|
type: "list",
|
|
262
251
|
name: "action",
|
|
263
252
|
message: "What would you like to do?",
|
|
@@ -272,7 +261,7 @@ async function runGenerator(options) {
|
|
|
272
261
|
return;
|
|
273
262
|
}
|
|
274
263
|
if (action === "full") {
|
|
275
|
-
const { confirm } = await
|
|
264
|
+
const { confirm } = await inquirer.prompt([{
|
|
276
265
|
type: "confirm",
|
|
277
266
|
name: "confirm",
|
|
278
267
|
message: import_chalk.default.red.bold("Are you sure? This will permanently delete all files in the output directory."),
|
|
@@ -298,7 +287,7 @@ async function runGenerator(options) {
|
|
|
298
287
|
console.log(import_chalk.default.yellow("No modules found in the spec to update. Exiting."));
|
|
299
288
|
return;
|
|
300
289
|
}
|
|
301
|
-
const { modulesToRegenerate } = await
|
|
290
|
+
const { modulesToRegenerate } = await inquirer.prompt([{
|
|
302
291
|
type: "checkbox",
|
|
303
292
|
name: "modulesToRegenerate",
|
|
304
293
|
message: "Select the modules to generate or update:",
|
|
@@ -335,12 +324,11 @@ async function runGenerator(options) {
|
|
|
335
324
|
process.exit(1);
|
|
336
325
|
}
|
|
337
326
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
toCamelCase,
|
|
345
|
-
toPascalCase
|
|
327
|
+
|
|
328
|
+
// src/cli.ts
|
|
329
|
+
console.log("API Core Lib - Code Generator");
|
|
330
|
+
import_commander.program.option("-o, --output <path>", "Output directory for generated files", "src/lib/api-generated").option("--env-path <path>", ".env file path", import_path2.default.resolve(process.cwd(), ".env")).action((options) => {
|
|
331
|
+
const absoluteOutputPath = import_path2.default.resolve(process.cwd(), options.output);
|
|
332
|
+
runGeneratorV1({ ...options, output: absoluteOutputPath });
|
|
346
333
|
});
|
|
334
|
+
import_commander.program.parse(process.argv);
|