UNPKG

dce-dev-wizard

Version:

Wizard for managing development apps at Harvard DCE.

59 lines 2.78 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const clear_1 = __importDefault(require("clear")); // Import helpers const print_1 = __importDefault(require("../helpers/print")); const exec_1 = __importDefault(require("../helpers/exec")); const config_1 = __importDefault(require("../helpers/config")); /** * Perform a custom deployment now * @author Gabe Abrams * @param deployment the currently selected deployment */ const deployCustomNow = (deployment) => __awaiter(void 0, void 0, void 0, function* () { const { customStackDeploymentProcess, } = config_1.default; // Run the custom deployment process step by step for (const step of customStackDeploymentProcess.steps) { if (!step.dontClearBefore) { (0, clear_1.default)(); } // Print title print_1.default.title(step.title); console.log(''); console.log(step.description); console.log(''); // Ask for confirmation if (step.askUserBeforeContinuing) { print_1.default.enterToContinue(); } // Execute the command if (step.command) { // Inject values into placeholders in the command // For example, ${deploymentName} -> deployment.name let { command } = step; command = command.replace(/\$\{deploymentName\}/g, deployment.name); command = command.replace(/\$\{name\}/g, deployment.name); command = command.replace(/\$\{deploymentApp\}/g, deployment.app); command = command.replace(/\$\{app\}/g, deployment.app); command = command.replace(/\$\{deploymentProfile\}/g, deployment.profile); command = command.replace(/\$\{profile\}/g, deployment.profile); // Run the command (0, exec_1.default)(command, true); } } ; }); exports.default = deployCustomNow; //# sourceMappingURL=deployCustomNow.js.map