UNPKG

@stoked-cenv/cli

Version:

A well considered cli and Node.js library for helping manage application, infrastructure, and configuration management.

30 lines 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runCommand = exports.cenvSetup = void 0; const lib_1 = require("@stoked-cenv/lib"); const ui_1 = require("@stoked-cenv/ui"); async function cenvSetup(commandName, config, params, opts) { var _a; const initRes = await lib_1.Cenv.cenvSetup(commandName, config, params, opts); if (((_a = initRes.options) === null || _a === void 0 ? void 0 : _a.userInterface) && !process.env.CENV_SPAWNED) { if (!lib_1.Cenv.dashboard && !(opts === null || opts === void 0 ? void 0 : opts.cenv)) { initRes.options.dashboardOptions = { packages: initRes.packages, cmd: config.deploymentMode, options: initRes.options, }; lib_1.Cenv.dashboard = new ui_1.Dashboard(initRes.options.dashboardOptions); } process.env.CENV_DEFAULTS = 'true'; } return initRes; } exports.cenvSetup = cenvSetup; async function runCommand(cmd, params, options) { if (!cmd || !cmd.config) { lib_1.CenvLog.single.catchLog('attempting to exec subCommandRunner() without proper setup'); process.exit(991); } const initRes = await cenvSetup(cmd.fullName, cmd.config, params, options); await cmd.runCommand(initRes.params, initRes.options, initRes.packages); } exports.runCommand = runCommand; //# sourceMappingURL=utils.js.map