removePodEntry.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = removePodEntry;
  6. function _cliTools() {
  7. const data = require("@react-native-community/cli-tools");
  8. _cliTools = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. var _getPodspecName = _interopRequireDefault(require("../config/getPodspecName"));
  14. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15. /**
  16. * Copyright (c) Facebook, Inc. and its affiliates.
  17. *
  18. * This source code is licensed under the MIT license found in the
  19. * LICENSE file in the root directory of this source tree.
  20. *
  21. */
  22. function removePodEntry(podfileContent, podspecPath) {
  23. const podName = (0, _getPodspecName.default)(podspecPath); // this regex should catch line(s) with full pod definition, like: pod 'podname', :path => '../node_modules/podname', :subspecs => ['Sub2', 'Sub1']
  24. const podRegex = new RegExp(`\\n( |\\t)*pod\\s+("|')${podName}("|')(,\\s*(:[a-z]+\\s*=>)?\\s*(("|').*?("|')|\\[[\\s\\S]*?\\]))*\\n`, 'g');
  25. _cliTools().logger.debug(`Removing ${podName} from Pod file`);
  26. return podfileContent.replace(podRegex, '\n');
  27. }
  28. //# sourceMappingURL=removePodEntry.js.map