react-native-integrate
Version:
Automate integration of additional code into React Native projects
33 lines (32 loc) • 1.47 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getIosDeploymentVersion = getIosDeploymentVersion;
exports.getIosDeploymentVersionFromXcodeProject = getIosDeploymentVersionFromXcodeProject;
const xcode_1 = __importDefault(require("xcode"));
const constants_1 = require("../constants");
const getIosProjectPath_1 = require("./getIosProjectPath");
const xcode_context_1 = require("./xcode.context");
function getIosDeploymentVersion() {
// get current xcode context
let proj = xcode_context_1.xcodeContext.get();
if (!proj) {
// open project from file
const pbxFilePath = (0, getIosProjectPath_1.getPbxProjectPath)();
proj = xcode_1.default.project(pbxFilePath);
proj.parseSync();
}
return getIosDeploymentVersionFromXcodeProject(proj).version;
}
function getIosDeploymentVersionFromXcodeProject(proj) {
const nativeTarget = proj.getTarget(constants_1.Constants.XCODE_APPLICATION_TYPE);
let version = proj.getBuildPropertyByTarget('IPHONEOS_DEPLOYMENT_TARGET', 'Release', nativeTarget.target);
let target = 'main';
if (!version) {
version = proj.getBuildPropertyByTarget('IPHONEOS_DEPLOYMENT_TARGET', 'Release', proj.getFirstProject().firstProject);
target = 'root';
}
return { target, version };
}