@geek-fun/serverlessinsight
Version:
Full life cycle cross providers serverless application management for your fast-growing business.
27 lines (26 loc) • 1.12 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.template = void 0;
const types_1 = require("../types");
const yaml_1 = __importDefault(require("yaml"));
const deploy_1 = require("../stack/deploy");
const common_1 = require("../common");
const parser_1 = require("../parser");
const template = async (stackName, options) => {
const iac = (0, parser_1.parseYaml)((0, common_1.getIacLocation)(options.location));
await (0, common_1.setContext)({ ...options, stackName, provider: iac.provider.name }, true);
const { template } = (0, deploy_1.generateStackTemplate)(stackName, iac);
if (typeof template === 'string') {
common_1.logger.info(`\n${template}`);
}
else {
const output = options.format === types_1.TemplateFormat.JSON
? JSON.stringify(template, null, 2)
: yaml_1.default.stringify(template);
common_1.logger.info(`\n${output}`);
}
};
exports.template = template;