UNPKG

@altostra/core

Version:

Core library for shared types and logic

1 lines 1.13 kB
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,o,i){return new(o||(o=Promise))((function(r,n){function a(t){try{u(i.next(t))}catch(t){n(t)}}function s(t){try{u(i.throw(t))}catch(t){n(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof o?e:new o((function(t){t(e)}))).then(a,s)}u((i=i.apply(t,e||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GithubTemplate=void 0;const Template_1=require("../Template"),Common_1=require("./Common"),TEMPLATE_JSON_PATH=".altostra/template.json";class GithubTemplate extends Template_1.TemplateBase{constructor(t,e,o){super(Common_1.GITHUB_TEMPLATE_TYPE,t),this._provider=e,this._githubHost=o()}get repositoryName(){return Common_1.TEMPLATE_REPO_PREFIX+this.name}getTemplateMetadata(){return __awaiter(this,void 0,void 0,(function*(){const t=yield this._githubHost.downloadFile(this.repositoryName,TEMPLATE_JSON_PATH);return JSON.parse(t.toString("utf8"))}))}getZippedFiles(){return __awaiter(this,void 0,void 0,(function*(){return yield this._githubHost.downloadRepo(this.repositoryName)}))}}exports.GithubTemplate=GithubTemplate;