Няма описание
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-sites-delete.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const colorette_1 = require("colorette");
  5. const command_1 = require("../command");
  6. const utils_1 = require("../utils");
  7. const api_1 = require("../hosting/api");
  8. const prompt_1 = require("../prompt");
  9. const error_1 = require("../error");
  10. const requirePermissions_1 = require("../requirePermissions");
  11. const projectUtils_1 = require("../projectUtils");
  12. const requireConfig_1 = require("../requireConfig");
  13. const logger_1 = require("../logger");
  14. const LOG_TAG = "hosting:sites";
  15. exports.command = new command_1.Command("hosting:sites:delete <siteId>")
  16. .description("delete a Firebase Hosting site")
  17. .withForce()
  18. .before(requireConfig_1.requireConfig)
  19. .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.delete"])
  20. .action(async (siteId, options) => {
  21. const projectId = (0, projectUtils_1.needProjectId)(options);
  22. if (!siteId) {
  23. throw new error_1.FirebaseError("siteId is required");
  24. }
  25. logger_1.logger.info(`Deleting a site is a permanent action. If you delete a site, Firebase doesn't maintain records of deployed files or deployment history, and the site ${(0, colorette_1.underline)(siteId)} cannot be reactivated by you or anyone else.`);
  26. logger_1.logger.info();
  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 site ${(0, colorette_1.underline)(siteId)} for project ${(0, colorette_1.underline)(projectId)}? `,
  31. default: false,
  32. }, options);
  33. if (!confirmed) {
  34. return;
  35. }
  36. await (0, api_1.getSite)(projectId, siteId);
  37. await (0, api_1.deleteSite)(projectId, siteId);
  38. (0, utils_1.logLabeledSuccess)(LOG_TAG, `Successfully deleted site ${(0, colorette_1.bold)(siteId)} from project ${(0, colorette_1.bold)(projectId)}`);
  39. });