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.

hosting-channel-delete.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const colorette_1 = require("colorette");
  5. const { marked } = require("marked");
  6. const command_1 = require("../command");
  7. const utils_1 = require("../utils");
  8. const api_1 = require("../hosting/api");
  9. const prompt_1 = require("../prompt");
  10. const requireHostingSite_1 = require("../requireHostingSite");
  11. const requirePermissions_1 = require("../requirePermissions");
  12. const projectUtils_1 = require("../projectUtils");
  13. const requireConfig_1 = require("../requireConfig");
  14. const logger_1 = require("../logger");
  15. exports.command = new command_1.Command("hosting:channel:delete <channelId>")
  16. .description("delete a Firebase Hosting channel")
  17. .withForce()
  18. .option("--site <siteId>", "site in which the channel exists")
  19. .before(requireConfig_1.requireConfig)
  20. .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
  21. .before(requireHostingSite_1.requireHostingSite)
  22. .action(async (channelId, options) => {
  23. const projectId = (0, projectUtils_1.needProjectId)(options);
  24. const siteId = options.site;
  25. channelId = (0, api_1.normalizeName)(channelId);
  26. const channel = await (0, api_1.getChannel)(projectId, siteId, channelId);
  27. const confirmed = await (0, prompt_1.promptOnce)({
  28. name: "force",
  29. type: "confirm",
  30. message: `Are you sure you want to delete the Hosting Channel ${(0, colorette_1.underline)(channelId)} for site ${(0, colorette_1.underline)(siteId)}?`,
  31. default: false,
  32. }, options);
  33. if (!confirmed) {
  34. return;
  35. }
  36. await (0, api_1.deleteChannel)(projectId, siteId, channelId);
  37. if (channel) {
  38. try {
  39. await (0, api_1.removeAuthDomain)(projectId, channel.url);
  40. }
  41. catch (e) {
  42. (0, utils_1.logLabeledWarning)("hosting:channel", marked(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
  43. logger_1.logger.debug("[hosting] unable to remove auth domain", e);
  44. }
  45. }
  46. (0, utils_1.logLabeledSuccess)("hosting:channels", `Successfully deleted channel ${(0, colorette_1.bold)(channelId)} for site ${(0, colorette_1.bold)(siteId)}.`);
  47. });