UNPKG

@re-shell/cli

Version:

Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja

53 lines (52 loc) 2.54 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createBackendCommand = createBackendCommand; const commander_1 = require("commander"); const chalk_1 = __importDefault(require("chalk")); const add_backend_1 = require("./add-backend"); const backend_selector_1 = require("../utils/backend-selector"); const spinner_1 = require("../utils/spinner"); function createBackendCommand() { const backendCommand = new commander_1.Command('backend'); backendCommand .description('Create and manage backend microservices') .argument('[name]', 'Name of the backend service') .option('-t, --template <template>', 'Backend template to use (e.g., express, fastapi, nestjs)') .option('-p, --port <port>', 'Service port') .option('-d, --description <description>', 'Service description') .option('-l, --list', 'List all available backend templates') .option('--use-case <useCase>', 'Describe your use case for template recommendations') .action(async (name, options) => { try { if (options.list) { (0, backend_selector_1.listBackendTemplates)(); return; } if (!name) { console.log(chalk_1.default.red('Error: Service name is required')); console.log(chalk_1.default.gray('Usage: reshell backend <service-name> [options]')); console.log(chalk_1.default.gray(' reshell backend --list')); console.log(chalk_1.default.gray('\nExamples:')); console.log(chalk_1.default.gray(' reshell backend auth-service --template fastapi')); console.log(chalk_1.default.gray(' reshell backend user-service --template nestjs --port 3001')); console.log(chalk_1.default.gray(' reshell backend api-gateway --use-case "I need an API gateway"')); return; } const spinner = (0, spinner_1.createSpinner)('Creating backend service...').start(); try { await (0, add_backend_1.addBackend)(name, { ...options, spinner }); } finally { spinner.stop(); } } catch (error) { console.error(chalk_1.default.red('Error:'), error); process.exit(1); } }); return backendCommand; }