capacitor.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.CapacitorJSONConfig = void 0;
  4. const cli_framework_1 = require("@ionic/cli-framework");
  5. const lodash = require("lodash");
  6. class CapacitorJSONConfig extends cli_framework_1.BaseConfig {
  7. constructor(p) {
  8. super(p, { spaces: "\t" });
  9. }
  10. provideDefaults(config) {
  11. return config;
  12. }
  13. setServerUrl(url) {
  14. const serverConfig = this.get("server") || {};
  15. if (typeof serverConfig.url === "string") {
  16. serverConfig.originalUrl = serverConfig.url;
  17. }
  18. serverConfig.url = url;
  19. this.set("server", serverConfig);
  20. }
  21. resetServerUrl() {
  22. const serverConfig = this.get("server") || {};
  23. delete serverConfig.url;
  24. if (serverConfig.originalUrl) {
  25. serverConfig.url = serverConfig.originalUrl;
  26. delete serverConfig.originalUrl;
  27. }
  28. if (lodash.isEmpty(serverConfig)) {
  29. this.unset("server");
  30. }
  31. else {
  32. this.set("server", serverConfig);
  33. }
  34. }
  35. }
  36. exports.CapacitorJSONConfig = CapacitorJSONConfig;