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.

release.js 1.1KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const lodash_1 = require("lodash");
  4. const rulesDeploy_1 = require("../../rulesDeploy");
  5. async function default_1(context, options) {
  6. const rulesConfigsToDeploy = (0, lodash_1.get)(context, "storage.rulesConfigsToDeploy", []);
  7. const rulesDeploy = (0, lodash_1.get)(context, "storage.rulesDeploy");
  8. if (!rulesConfigsToDeploy.length || !rulesDeploy) {
  9. return [];
  10. }
  11. const toRelease = [];
  12. for (const ruleConfig of rulesConfigsToDeploy) {
  13. if (ruleConfig.target) {
  14. options.rc.target(options.project, "storage", ruleConfig.target).forEach((bucket) => {
  15. toRelease.push({ bucket: bucket, rules: ruleConfig.rules });
  16. });
  17. }
  18. else {
  19. toRelease.push({ bucket: ruleConfig.bucket, rules: ruleConfig.rules });
  20. }
  21. }
  22. await Promise.all(toRelease.map((r) => {
  23. return rulesDeploy.release(r.rules, rulesDeploy_1.RulesetServiceType.FIREBASE_STORAGE, r.bucket);
  24. }));
  25. return toRelease.map((r) => r.bucket);
  26. }
  27. exports.default = default_1;