Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

handlePreviewToggles.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.handlePreviewToggles = void 0;
  4. const colorette_1 = require("colorette");
  5. const experiments = require("./experiments");
  6. function errorOut(name) {
  7. console.log(`${(0, colorette_1.bold)((0, colorette_1.red)("Error:"))} Did not recognize preview feature ${(0, colorette_1.bold)(name || "")}`);
  8. process.exit(1);
  9. }
  10. function handlePreviewToggles(args) {
  11. const name = args[1];
  12. const isValid = experiments.isValidExperiment(name);
  13. if (args[0] === "--open-sesame") {
  14. console.log(`${(0, colorette_1.bold)("firebase --open-sesame")} is deprecated and wil be removed in a future ` +
  15. `version. Use the new "experiments" family of commands, including ${(0, colorette_1.bold)("firebase experiments:enable")}`);
  16. if (isValid) {
  17. console.log(`Enabling experiment ${(0, colorette_1.bold)(name)} ...`);
  18. experiments.setEnabled(name, true);
  19. experiments.flushToDisk();
  20. console.log("Experiment enabled!");
  21. return process.exit(0);
  22. }
  23. errorOut(name);
  24. }
  25. else if (args[0] === "--close-sesame") {
  26. console.log(`${(0, colorette_1.bold)("firebase --open-sesame")} is deprecated and wil be removed in a future ` +
  27. `version. Use the new "experiments" family of commands, including ${(0, colorette_1.bold)("firebase experiments:disable")}`);
  28. if (isValid) {
  29. console.log(`Disabling experiment ${(0, colorette_1.bold)(name)}...`);
  30. experiments.setEnabled(name, false);
  31. experiments.flushToDisk();
  32. return process.exit(0);
  33. }
  34. errorOut(name);
  35. }
  36. return false;
  37. }
  38. exports.handlePreviewToggles = handlePreviewToggles;