Няма описание
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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const command_1 = require("../command");
  5. const extensionsHelper_1 = require("../extensions/extensionsHelper");
  6. const extensionsApi_1 = require("../extensions/extensionsApi");
  7. const utils = require("../utils");
  8. const refs = require("../extensions/refs");
  9. const prompt_1 = require("../prompt");
  10. const clc = require("colorette");
  11. const requireAuth_1 = require("../requireAuth");
  12. const error_1 = require("../error");
  13. const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
  14. exports.command = new command_1.Command("ext:dev:unpublish <extensionRef>")
  15. .description("unpublish an extension")
  16. .withForce()
  17. .help("use this command to unpublish an extension, and make it unavailable for developers to install or reconfigure. " +
  18. "Specify the extension you want to unpublish using the format '<publisherId>/<extensionId>.")
  19. .before(requireAuth_1.requireAuth)
  20. .before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extDevMinVersion")
  21. .action(async (extensionRef, options) => {
  22. const { publisherId, extensionId, version } = refs.parse(extensionRef);
  23. utils.logLabeledWarning(extensionsHelper_1.logPrefix, "If you unpublish this extension, developers won't be able to install it. For developers who currently have this extension installed, it will continue to run and will appear as unpublished when listed in the Firebase console or Firebase CLI.");
  24. utils.logLabeledWarning("This is a permanent action", `Once unpublished, you may never use the extension name '${clc.bold(extensionId)}' again.`);
  25. if (version) {
  26. throw new error_1.FirebaseError(`Unpublishing a single version is not currently supported. You can only unpublish ${clc.bold("ALL versions")} of an extension. To unpublish all versions, please remove the version from the reference.`);
  27. }
  28. await (0, extensionsApi_1.getExtension)(extensionRef);
  29. const consent = await comfirmUnpublish(publisherId, extensionId, options);
  30. if (!consent) {
  31. throw new error_1.FirebaseError("unpublishing cancelled.");
  32. }
  33. await (0, extensionsApi_1.unpublishExtension)(extensionRef);
  34. utils.logLabeledSuccess(extensionsHelper_1.logPrefix, "successfully unpublished all versions of this extension.");
  35. });
  36. async function comfirmUnpublish(publisherId, extensionId, options) {
  37. if (options.nonInteractive && !options.force) {
  38. throw new error_1.FirebaseError("Pass the --force flag to use this command in non-interactive mode");
  39. }
  40. if (options.nonInteractive && options.force) {
  41. return true;
  42. }
  43. const message = `You are about to unpublish ALL versions of ${clc.green(`${publisherId}/${extensionId}`)}.\nDo you wish to continue? `;
  44. return (0, prompt_1.promptOnce)({
  45. type: "confirm",
  46. message,
  47. default: false,
  48. });
  49. }