liveperson-functions-cli
Version:
LivePerson Functions CLI
51 lines • 2.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeployController = void 0;
const deploy_view_1 = require("../../view/deploy.view");
const deployment_controller_1 = require("./deployment.controller");
const file_service_1 = require("../../service/file.service");
class DeployController extends deployment_controller_1.DeploymentController {
constructor({ deployView = new deploy_view_1.DeployView(), fileService = new file_service_1.FileService(), } = {}) {
super(fileService);
this.deployView = deployView;
}
/**
* Gather informations about the passed functions depending on the flags and
* starts the deploy process.
* @param {IDeployConfig} { lambdaFunctions, inputFlags }
* @returns {Promise<void>} - deploy view, which runs the deploy requests
* @memberof DeployController
*/
async deploy({ lambdaFunctions, inputFlags, }) {
try {
const functionsToDeploy = await this.collectLambdaInformationForAllLambdas(lambdaFunctions);
let confirmedFunctionsToDeploy = [];
if (inputFlags === null || inputFlags === void 0 ? void 0 : inputFlags.yes) {
confirmedFunctionsToDeploy = functionsToDeploy;
}
else {
const answer = await this.deployView.askForConfirmation(functionsToDeploy);
confirmedFunctionsToDeploy = functionsToDeploy.filter((entry) => answer[entry.name]);
/* istanbul ignore else */
if (confirmedFunctionsToDeploy.length === 0) {
return;
}
}
await this.deployView.showDeployments({
confirmedFunctionsToDeploy,
noWatch: inputFlags === null || inputFlags === void 0 ? void 0 : inputFlags['no-watch'],
});
}
catch (error) {
const prettyError = {
message: error.message || error.errorMsg,
suggestions: ['Use "lpf deploy --help" for more information'],
ref: 'https://github.com/LivePersonInc/faas-cli#deploy',
};
this.deployView.showErrorMessage(prettyError);
throw new Error('exit');
}
}
}
exports.DeployController = DeployController;
//# sourceMappingURL=deploy.controller.js.map