UNPKG

event-sourcing-generator

Version:

Utils for generating CQRS + Event Sourcing classes for NestJS

36 lines (35 loc) 1.84 kB
#!/usr/bin/env node "use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const commander = require("commander"); const config_action_1 = require("./actions/config.action"); const help_action_1 = require("./actions/help.action"); const commands_generator_1 = require("./utils/commands-generator"); const pkgJson = require('../package.json'); (() => __awaiter(void 0, void 0, void 0, function* () { const program = new commander.Command(); program .usage('[command] [options]') .description('A CLI for generating classes for CQRS + ES for NestJS') .version(pkgJson.version); program.command("info").alias("i").description("Show CLI Info.").action(help_action_1.helpAction); const configCommand = new commander.Command('config').action(() => configCommand.outputHelp()); config_action_1.createConfigCommand(configCommand); program.addCommand(configCommand); yield commands_generator_1.generateCommands(program); yield program.parseAsync(process.argv); if (!process.argv.slice(2).length) { program.outputHelp(); } }))() .then() .catch(err => console.error(err));