getDependenciesFromPodfileLock.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = getDependenciesFromPodfileLock;
  6. function _fs() {
  7. const data = _interopRequireDefault(require("fs"));
  8. _fs = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _chalk() {
  14. const data = _interopRequireDefault(require("chalk"));
  15. _chalk = function () {
  16. return data;
  17. };
  18. return data;
  19. }
  20. function _cliTools() {
  21. const data = require("@react-native-community/cli-tools");
  22. _cliTools = function () {
  23. return data;
  24. };
  25. return data;
  26. }
  27. function _jsYaml() {
  28. const data = require("js-yaml");
  29. _jsYaml = function () {
  30. return data;
  31. };
  32. return data;
  33. }
  34. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  35. const CHECKSUM_KEY = 'SPEC CHECKSUMS';
  36. function getDependenciesFromPodfileLock(podfileLockPath) {
  37. _cliTools().logger.debug(`Reading ${podfileLockPath}`);
  38. let fileContent;
  39. try {
  40. fileContent = _fs().default.readFileSync(podfileLockPath, 'utf8');
  41. } catch (err) {
  42. _cliTools().logger.error(`Could not find "Podfile.lock" at ${_chalk().default.dim(podfileLockPath)}. Did you run "${_chalk().default.bold('pod install')}" in iOS directory?`);
  43. return [];
  44. } // Previous portions of the lock file could be invalid yaml.
  45. // Only parse parts that are valid
  46. const tail = fileContent.split(CHECKSUM_KEY).slice(1);
  47. const checksumTail = CHECKSUM_KEY + tail;
  48. return Object.keys((0, _jsYaml().safeLoad)(checksumTail)[CHECKSUM_KEY] || {});
  49. }
  50. //# sourceMappingURL=getDependenciesFromPodfileLock.js.map