UNPKG

node-apis

Version:

🚀 Advanced TypeScript API generator with clean architecture, comprehensive testing, and automatic formatting. Generate production-ready Node.js APIs with complete integration test suites.

47 lines 2.43 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.main = void 0; const commander_1 = require("commander"); const chalk_1 = __importDefault(require("chalk")); const generate_command_1 = require("./cli/commands/generate.command"); const main = async () => { const program = new commander_1.Command(); program .name('node-apis') .description('Generate boilerplate folder structures for Node.js API modules') .version('3.6.0') .option('-n, --name <name>', 'module name (skips interactive prompt)') .option('-f, --force', 'overwrite existing directories') .option('--no-interactive', 'disable interactive mode') .option('--crud', 'generate CRUD operations (create, get, list, delete, update)') .option('--custom <names>', 'generate custom API operations (comma-separated names)') .option('--services <names>', 'generate internal service operations (comma-separated names)') .option('--framework <framework>', 'web framework to use (express|hono|t3)') .option('--api-style <style>', 'API style to generate (rest|trpc)') .option('--init-config', 'initialize configuration file') .option('--set-framework <framework>', 'set default framework in config (express|hono|t3)') .option('--set-api-style <style>', 'set default API style in config (rest|trpc)') .option('--target-dir <dir>', 'target directory for generated files (default: current directory)') .option('--trpc-style', 'generate tRPC procedures instead of REST controllers (deprecated, use --api-style trpc)') .option('--set-trpc-style <boolean>', 'set default tRPC style preference in config (deprecated, use --set-api-style)') .parse(); const options = program.opts(); // Handle config commands or regular generation await (0, generate_command_1.handleGenerateCommand)(options); }; exports.main = main; process.on('SIGINT', () => { console.log(chalk_1.default.yellow('\n\n⏹️ Generation cancelled by user')); process.exit(0); }); // Run the CLI if (require.main === module) { (0, exports.main)().catch(error => { console.error('CLI Error:', error); process.exit(1); }); } //# sourceMappingURL=index.js.map