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-disable.js 1.5KB

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const clc = require("colorette");
  5. const apiv2_1 = require("../apiv2");
  6. const command_1 = require("../command");
  7. const api_1 = require("../api");
  8. const prompt_1 = require("../prompt");
  9. const requireHostingSite_1 = require("../requireHostingSite");
  10. const requirePermissions_1 = require("../requirePermissions");
  11. const utils = require("../utils");
  12. exports.command = new command_1.Command("hosting:disable")
  13. .description("stop serving web traffic to your Firebase Hosting site")
  14. .option("-f, --force", "skip confirmation")
  15. .option("-s, --site <siteName>", "the site to disable")
  16. .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
  17. .before(requireHostingSite_1.requireHostingSite)
  18. .action(async (options) => {
  19. const siteToDisable = options.site;
  20. const confirm = await (0, prompt_1.promptOnce)({
  21. type: "confirm",
  22. name: "force",
  23. message: `Are you sure you want to disable Firebase Hosting for the site ${clc.underline(siteToDisable)}\n${clc.underline("This will immediately make your site inaccessible!")}`,
  24. }, options);
  25. if (!confirm) {
  26. return;
  27. }
  28. const c = new apiv2_1.Client({ urlPrefix: api_1.hostingApiOrigin, apiVersion: "v1beta1", auth: true });
  29. await c.post(`/sites/${siteToDisable}/releases`, { type: "SITE_DISABLE" });
  30. utils.logSuccess(`Hosting has been disabled for ${clc.bold(siteToDisable)}. Deploy a new version to re-enable.`);
  31. });