@react-native-firebase/perf
Version:
React Native Firebase - React Native Firebase provides native integration with Performance Monitoring to gain insight into key performance characteristics within your React Native application.
29 lines (28 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withApplyPerfPlugin = void 0;
exports.applyPlugin = applyPlugin;
const config_plugins_1 = require("@expo/config-plugins");
const constants_1 = require("./constants");
/**
* Update `app/build.gradle` by applying performance monitoring plugin
*/
const withApplyPerfPlugin = config => {
return (0, config_plugins_1.withAppBuildGradle)(config, config => {
if (config.modResults.language === 'groovy') {
config.modResults.contents = applyPlugin(config.modResults.contents);
}
else {
config_plugins_1.WarningAggregator.addWarningAndroid('react-native-firebase-perf', `Cannot automatically configure app build.gradle if it's not groovy`);
}
return config;
});
};
exports.withApplyPerfPlugin = withApplyPerfPlugin;
function applyPlugin(appBuildGradle) {
const perfPattern = new RegExp(`apply\\s+plugin:\\s+['"]${constants_1.perfMonitoringPlugin}['"]`);
if (!appBuildGradle.match(perfPattern)) {
appBuildGradle += `\napply plugin: '${constants_1.perfMonitoringPlugin}'`;
}
return appBuildGradle;
}