api-core-lib 12.12.103 → 12.12.104
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 +6 -5
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -479,10 +479,11 @@ export * from './${camelCaseModuleName}.endpoints';`;
|
|
|
479
479
|
import_fs.default.writeFileSync(import_path.default.join(moduleOutputPath, "server.ts"), serverEntryPointContent);
|
|
480
480
|
console.log(import_chalk.default.gray(` \u2713 server.ts (Server Entry Point)`));
|
|
481
481
|
}
|
|
482
|
-
async function
|
|
482
|
+
async function runGenerator(options) {
|
|
483
483
|
console.log(import_chalk.default.cyan.bold("\u{1F680} Starting API Development Platform Generator..."));
|
|
484
484
|
import_dotenv.default.config({ path: options.envPath });
|
|
485
485
|
const specUrl = process.env.OPENAPI_SPEC_URL || "./swagger.json";
|
|
486
|
+
const prompt = import_inquirer.default.default?.prompt || import_inquirer.default.prompt;
|
|
486
487
|
try {
|
|
487
488
|
console.log(import_chalk.default.blue(`
|
|
488
489
|
\u23F3 Step 1: Dereferencing spec from ${specUrl}...`));
|
|
@@ -496,7 +497,7 @@ async function runGeneratorV1(options) {
|
|
|
496
497
|
if (import_fs.default.existsSync(outputDir)) {
|
|
497
498
|
console.log(import_chalk.default.yellow.bold(`
|
|
498
499
|
\u26A0\uFE0F An existing generation has been found at: ${outputDir}`));
|
|
499
|
-
const { action } = await
|
|
500
|
+
const { action } = await prompt([{
|
|
500
501
|
type: "list",
|
|
501
502
|
name: "action",
|
|
502
503
|
message: "What would you like to do?",
|
|
@@ -511,7 +512,7 @@ async function runGeneratorV1(options) {
|
|
|
511
512
|
return;
|
|
512
513
|
}
|
|
513
514
|
if (action === "full") {
|
|
514
|
-
const { confirm } = await
|
|
515
|
+
const { confirm } = await prompt([{
|
|
515
516
|
type: "confirm",
|
|
516
517
|
name: "confirm",
|
|
517
518
|
message: import_chalk.default.red.bold("Are you sure? This will permanently delete all files in the output directory."),
|
|
@@ -537,7 +538,7 @@ async function runGeneratorV1(options) {
|
|
|
537
538
|
console.log(import_chalk.default.yellow("No modules found in the spec to update. Exiting."));
|
|
538
539
|
return;
|
|
539
540
|
}
|
|
540
|
-
const { modulesToRegenerate } = await
|
|
541
|
+
const { modulesToRegenerate } = await prompt([{
|
|
541
542
|
type: "checkbox",
|
|
542
543
|
name: "modulesToRegenerate",
|
|
543
544
|
message: "Select the modules to generate or update:",
|
|
@@ -579,6 +580,6 @@ async function runGeneratorV1(options) {
|
|
|
579
580
|
console.log("API Core Lib - Code Generator");
|
|
580
581
|
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) => {
|
|
581
582
|
const absoluteOutputPath = import_path2.default.resolve(process.cwd(), options.output);
|
|
582
|
-
|
|
583
|
+
runGenerator({ ...options, output: absoluteOutputPath });
|
|
583
584
|
});
|
|
584
585
|
import_commander.program.parse(process.argv);
|