UNPKG

@veecode-platform/safira-cli

Version:

Generate a microservice project from your spec.

45 lines (44 loc) 1.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigureCatalogInfo = void 0; const github_content_manager_1 = require("../git/github/github-content-manager"); const yaml_utils_1 = require("../utils/yaml-utils"); const git_providers_1 = require("../git/git-providers"); class ConfigureCatalogInfo { constructor() { } async setupCatalogInfo(provider, credential, ownerAndRepository, branch) { const fileContent = yaml_utils_1.YamlUtils.stringify({ apiVersion: "backstage.io/v1alpha1", kind: "Location", metadata: { name: `${provider}-catalog-info`, description: "Importing apis", }, spec: { targets: [ "./api/*.yaml", ], }, }); switch (provider) { case git_providers_1.GitProviderEnum.github: await github_content_manager_1.GithubContentManager.instance.uploadOrUpdateContent({ branch: branch, commitMessage: "Configuring catalog-info", fileContent: fileContent, githubCredential: credential, ownerAndRepository: ownerAndRepository, remoteFilePath: "catalog-info.yaml", }); break; default: throw new Error(`Provider ${provider} not supported`); } } static get instance() { if (!this._instance) this._instance = new this(); return this._instance; } } exports.ConfigureCatalogInfo = ConfigureCatalogInfo;