react-native-quick-crypto
Version:
A fast implementation of Node's `crypto` module written in C/C++ JSI
51 lines (48 loc) • 2.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.withXCode = void 0;
var _expoBuildProperties = require("expo-build-properties");
var _configPlugins = require("expo/config-plugins");
var _fs = _interopRequireDefault(require("fs"));
var _path = _interopRequireDefault(require("path"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Workaround for some jank XCode releases that break React Native native modules
*
* see: https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
*/
const withXCode = config => {
// Use expo-build-properties to bump iOS deployment target
config = (0, _expoBuildProperties.withBuildProperties)(config, {
ios: {
deploymentTarget: '16.1'
}
});
// Patch the generated Podfile fallback to ensure platform is always 16.1
config = (0, _configPlugins.withDangerousMod)(config, ['ios', modConfig => {
const podfilePath = _path.default.join(modConfig.modRequest.platformProjectRoot, 'Podfile');
let contents = _fs.default.readFileSync(podfilePath, 'utf-8');
// Check if the IPHONEOS_DEPLOYMENT_TARGET setting is already present
// We search for the key being assigned, e.g., config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] =
const deploymentTargetSettingExists = /\.build_settings\s*\[\s*['"]IPHONEOS_DEPLOYMENT_TARGET['"]\s*\]\s*=/.test(contents);
if (!deploymentTargetSettingExists) {
// IPHONEOS_DEPLOYMENT_TARGET setting not found, proceed to add it.
contents = contents.replace(/(post_install\s+do\s+\|installer\|[\s\S]*?)(\r?\n\s\send\s*)$/m, `$1
# Expo Build Properties: force deployment target
# https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.1'
end
end
$2`);
}
_fs.default.writeFileSync(podfilePath, contents);
return modConfig;
}]);
return config;
};
exports.withXCode = withXCode;
//# sourceMappingURL=withXCode.js.map