UNPKG

lambdaorm-cli

Version:
93 lines 3.58 kB
"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()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BuildCommand = void 0; const usesCases_1 = require("../builders/usesCases"); const path_1 = __importDefault(require("path")); class BuildCommand { constructor() { this.command = 'build'; this.describe = 'build model, repositories'; } builder(args) { return args .option('w', { alias: 'workspace', type: 'string', describe: 'project path.' }).option('l', { alias: 'language', describe: 'develop language' }).option('m', { alias: 'model', describe: 'build model' }).option('r', { alias: 'repositories', describe: 'build repositories' }).option('a', { alias: 'all', describe: 'build model and repositories' }) .option('src-path', { alias: 'srcPath', describe: 'relative source code path in workspace' }) .option('data-path', { alias: 'dataPath', describe: 'relative data path in workspace' }) .option('domain-path', { alias: 'domainPath', describe: 'relative domain path in source code path' }) .option('u', { alias: 'url', describe: 'Url of service.' }); } handler(args) { return __awaiter(this, void 0, void 0, function* () { const workspace = path_1.default.resolve(process.cwd(), args.workspace || '.'); const language = args.language || 'node'; const model = args.model !== undefined; const repositories = args.repositories !== undefined; const all = args.all !== undefined; const srcPath = args.srcPath; const domainPath = args.domainPath; const dataPath = args.dataPath; const url = args.url; const options = []; if (!model && !repositories && !all) { options.push('model'); options.push('repositories'); } else { if (model || all) { options.push('model'); } if (repositories || all) { options.push('repositories'); } } try { yield usesCases_1.build.execute({ workspace, language, options, srcPath, dataPath, domainPath, url }); } catch (error) { console.error(`error: ${error}`); } }); } } exports.BuildCommand = BuildCommand; //# sourceMappingURL=build.js.map