findPodTargetLine.js 785 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = findPodTargetLine;
  6. /**
  7. * Copyright (c) Facebook, Inc. and its affiliates.
  8. *
  9. * This source code is licensed under the MIT license found in the
  10. * LICENSE file in the root directory of this source tree.
  11. *
  12. */
  13. function findPodTargetLine(podLines, projectName) {
  14. const targetName = projectName.replace('.xcodeproj', ''); // match first target definition in file: target 'target_name' do
  15. const targetRegex = new RegExp(`target ('|")${targetName}('|") do`, 'g');
  16. for (let i = 0, len = podLines.length; i < len; i++) {
  17. const match = podLines[i].match(targetRegex);
  18. if (match) {
  19. return i + 1;
  20. }
  21. }
  22. return null;
  23. }
  24. //# sourceMappingURL=findPodTargetLine.js.map