UNPKG

@veecode-platform/safira-cli

Version:

Generate a microservice project from your spec.

42 lines (41 loc) 1.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const color_1 = tslib_1.__importDefault(require("@oclif/color")); const core_1 = require("@oclif/core"); const spec_discovery_1 = require("../../safira-globals/spec-discovery"); const safira_utils_1 = require("../../safira-project/safira-utils"); const update_project_1 = require("../../update/update-project"); const file_system_utils_1 = require("../../utils/file-system-utils"); class ProjectUpdate extends core_1.Command { async run() { const { args, flags } = await this.parse(ProjectUpdate); const projectFolder = file_system_utils_1.FileSystemUtils.getCurrentPath(); let openApiFile = ""; try { openApiFile = await spec_discovery_1.SpecDiscovery.discoverSpecs({ projectPath: projectFolder }); } catch (error) { console.log(color_1.default.red(error.message)); process.exit(2); } try { await update_project_1.UpdateProject.instance.updateProject(openApiFile); } catch (error) { this.log(color_1.default.red(error.message)); } finally { safira_utils_1.SafiraUtils.deleteTmpFolder(); } } } exports.default = ProjectUpdate; ProjectUpdate.description = "Update an existing safira project"; ProjectUpdate.flags = { help: core_1.Flags.help({ char: "h" }), "openapi-file-path": core_1.Flags.string({ char: "o", description: "The path to the OpenAPI file." }), "insomnia-workspace": core_1.Flags.string({ char: "i", description: "Import OpenAPI file from the INSOMNIA Workspace." }), "inso-spec-name": core_1.Flags.string({ description: "The name of the INSO specification." }), }; ProjectUpdate.args = [];