removeFromProjectReferences.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = removeFromProjectReferences;
  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. /**
  14. * For each file (.xcodeproj), there's an entry in `projectReferences` created
  15. * that has two entries - `ProjectRef` - reference to a file.uuid and
  16. * `ProductGroup` - uuid of a Products group.
  17. *
  18. * When projectReference is found - it's deleted and the removed value is returned
  19. * so that ProductGroup in PBXGroup section can be removed as well.
  20. *
  21. * Otherwise returns null
  22. */
  23. function removeFromProjectReferences(project, file) {
  24. const {
  25. firstProject
  26. } = project.getFirstProject();
  27. const projectRef = firstProject.projectReferences.find(item => item.ProjectRef === file.uuid);
  28. if (!projectRef) {
  29. return null;
  30. }
  31. firstProject.projectReferences.splice(firstProject.projectReferences.indexOf(projectRef), 1);
  32. return projectRef;
  33. }
  34. //# sourceMappingURL=removeFromProjectReferences.js.map