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

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