mirror of
https://github.com/status-im/react-native.git
synced 2025-01-19 14:02:10 +00:00
aba4ec0c09
Reviewed By: yungsters Differential Revision: D7962462 fbshipit-source-id: 0afe2092af8703895de91a6d1400315c3173aa6d
28 lines
707 B
JavaScript
28 lines
707 B
JavaScript
/** @format */
|
|
|
|
'use strict';
|
|
|
|
const glob = require('glob');
|
|
const path = require('path');
|
|
|
|
module.exports = function findPodspecName(folder) {
|
|
const podspecs = glob.sync('*.podspec', {cwd: folder});
|
|
let podspecFile = null;
|
|
if (podspecs.length === 0) {
|
|
return null;
|
|
} else if (podspecs.length === 1) {
|
|
podspecFile = podspecs[0];
|
|
} else {
|
|
const folderParts = folder.split(path.sep);
|
|
const currentFolder = folderParts[folderParts.length - 1];
|
|
const toSelect = podspecs.indexOf(currentFolder + '.podspec');
|
|
if (toSelect === -1) {
|
|
podspecFile = podspecs[0];
|
|
} else {
|
|
podspecFile = podspecs[toSelect];
|
|
}
|
|
}
|
|
|
|
return podspecFile.replace('.podspec', '');
|
|
};
|