UNPKG

navy

Version:

Quick and powerful development environments using Docker and Docker Compose

44 lines (34 loc) 1.3 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.importNavy = importNavy; var _chalk = _interopRequireDefault(require("chalk")); var _driverLogging = require("../../driver-logging"); var _errors = require("../../errors"); const OPTION_LABEL_MAP = { configProvider: 'Provider', path: 'Directory', npmPackage: 'NPM Package' }; async function importNavy(navy, initialiseOpts) { if (await navy.isInitialised()) { throw new _errors.NavyError(`Navy "${navy.name}" has already been imported and initialised.`); } await navy.initialise(initialiseOpts); await navy.ensurePluginsLoaded(); await navy.emitAsync('cli.import'); (0, _driverLogging.startDriverLogging)('Ensuring services are up to date...'); await navy.relaunch(); (0, _driverLogging.stopDriverLogging)(); console.log(); console.log(_chalk.default.green(` Navy "${_chalk.default.white.bold(navy.name)}" has now been imported and initialised. 🎉`)); console.log(); for (const key in initialiseOpts) { if (OPTION_LABEL_MAP[key]) { console.log(` ${_chalk.default.bold(OPTION_LABEL_MAP[key])}: ${_chalk.default.dim(initialiseOpts[key])}`); } } console.log(); }