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.

deploymentSummary.js 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.deletesSummary = exports.configuresSummary = exports.updatesSummary = exports.createsSummary = exports.humanReadable = void 0;
  4. const clc = require("colorette");
  5. const refs = require("../../extensions/refs");
  6. const humanReadable = (dep) => `${clc.bold(dep.instanceId)} (${dep.ref ? `${refs.toExtensionVersionRef(dep.ref)}` : `Installed from local source`})`;
  7. exports.humanReadable = humanReadable;
  8. const humanReadableUpdate = (from, to) => {
  9. var _a;
  10. if (from.ref &&
  11. to.ref &&
  12. from.ref.publisherId === to.ref.publisherId &&
  13. from.ref.extensionId === to.ref.extensionId) {
  14. return `\t${clc.bold(from.instanceId)} (${refs.toExtensionVersionRef(from.ref)} => ${(_a = to.ref) === null || _a === void 0 ? void 0 : _a.version})`;
  15. }
  16. else {
  17. const fromRef = from.ref
  18. ? `${refs.toExtensionVersionRef(from.ref)}`
  19. : `Installed from local source`;
  20. const toRef = to.ref ? `${refs.toExtensionVersionRef(to.ref)}` : `Installed from local source`;
  21. return `\t${clc.bold(from.instanceId)} (${fromRef} => ${toRef})`;
  22. }
  23. };
  24. function createsSummary(toCreate) {
  25. const instancesToCreate = toCreate.map((s) => `\t${(0, exports.humanReadable)(s)}`).join("\n");
  26. return toCreate.length
  27. ? `The following extension instances will be created:\n${instancesToCreate}\n`
  28. : "";
  29. }
  30. exports.createsSummary = createsSummary;
  31. function updatesSummary(toUpdate, have) {
  32. const instancesToUpdate = toUpdate
  33. .map((to) => {
  34. const from = have.find((exists) => exists.instanceId === to.instanceId);
  35. return humanReadableUpdate(from, to);
  36. })
  37. .join("\n");
  38. return toUpdate.length
  39. ? `The following extension instances will be updated:\n${instancesToUpdate}\n`
  40. : "";
  41. }
  42. exports.updatesSummary = updatesSummary;
  43. function configuresSummary(toConfigure) {
  44. const instancesToConfigure = toConfigure.map((s) => `\t${(0, exports.humanReadable)(s)}`).join("\n");
  45. return toConfigure.length
  46. ? `The following extension instances will be configured:\n${instancesToConfigure}\n`
  47. : "";
  48. }
  49. exports.configuresSummary = configuresSummary;
  50. function deletesSummary(toDelete) {
  51. const instancesToDelete = toDelete.map((s) => `\t${(0, exports.humanReadable)(s)}`).join("\n");
  52. return toDelete.length
  53. ? `The following extension instances are not listed in 'firebase.json':\n${instancesToDelete}\n`
  54. : "";
  55. }
  56. exports.deletesSummary = deletesSummary;