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-sites-list.js 1.2KB

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const colorette_1 = require("colorette");
  5. const Table = require("cli-table");
  6. const command_1 = require("../command");
  7. const api_1 = require("../hosting/api");
  8. const requirePermissions_1 = require("../requirePermissions");
  9. const projectUtils_1 = require("../projectUtils");
  10. const logger_1 = require("../logger");
  11. const TABLE_HEAD = ["Site ID", "Default URL", "App ID (if set)"];
  12. exports.command = new command_1.Command("hosting:sites:list")
  13. .description("list Firebase Hosting sites")
  14. .before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
  15. .action(async (options) => {
  16. const projectId = (0, projectUtils_1.needProjectId)(options);
  17. const sites = await (0, api_1.listSites)(projectId);
  18. const table = new Table({ head: TABLE_HEAD, style: { head: ["green"] } });
  19. for (const site of sites) {
  20. const siteId = site.name.split("/").pop();
  21. table.push([siteId, site.defaultUrl, site.appId || "--"]);
  22. }
  23. logger_1.logger.info();
  24. logger_1.logger.info(`Sites for project ${(0, colorette_1.bold)(projectId)}`);
  25. logger_1.logger.info();
  26. logger_1.logger.info(table.toString());
  27. return { sites };
  28. });