No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

target.js 1.3KB

12345678910111213141516171819202122232425262728293031323334
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const clc = require("colorette");
  5. const command_1 = require("../command");
  6. const logger_1 = require("../logger");
  7. const requireConfig_1 = require("../requireConfig");
  8. const utils = require("../utils");
  9. function logTargets(type, targets) {
  10. logger_1.logger.info(clc.cyan("[ " + type + " ]"));
  11. for (const [name, resources] of Object.entries(targets)) {
  12. logger_1.logger.info(name, "(" + (resources || []).join(",") + ")");
  13. }
  14. }
  15. exports.command = new command_1.Command("target [type]")
  16. .description("display configured deploy targets for the current project")
  17. .before(requireConfig_1.requireConfig)
  18. .action((type, options) => {
  19. if (!options.project) {
  20. return utils.reject("No active project, cannot list deploy targets.");
  21. }
  22. logger_1.logger.info("Resource targets for", clc.bold(options.project) + ":");
  23. logger_1.logger.info();
  24. if (type) {
  25. const targets = options.rc.targets(options.project, type);
  26. logTargets(type, targets);
  27. return targets;
  28. }
  29. const allTargets = options.rc.allTargets(options.project);
  30. for (const [targetType, targetName] of Object.entries(allTargets)) {
  31. logTargets(targetType, targetName);
  32. }
  33. return allTargets;
  34. });