@react-native-firebase/perf 12.9.0 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +18 -0
- package/android/build.gradle +1 -1
- package/lib/version.js +1 -1
- package/package.json +5 -5
- package/plugin/src/android/applyPlugin.ts +27 -0
- package/plugin/src/android/buildscriptDependency.ts +33 -0
- package/plugin/src/android/constants.ts +5 -0
- package/plugin/src/android/index.ts +4 -0
- package/plugin/src/index.ts +13 -0
- package/plugin/tsconfig.json +9 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,24 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [13.0.0](https://github.com/invertase/react-native-firebase/compare/v12.9.3...v13.0.0) (2021-10-31)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- rename default branch to main ([25e1d3d](https://github.com/invertase/react-native-firebase/commit/25e1d3d5a1a8311588938dc9d8fdf71d11cd9963))
|
11
|
+
|
12
|
+
## [12.9.3](https://github.com/invertase/react-native-firebase/compare/v12.9.2...v12.9.3) (2021-10-22)
|
13
|
+
|
14
|
+
**Note:** Version bump only for package @react-native-firebase/perf
|
15
|
+
|
16
|
+
## [12.9.2](https://github.com/invertase/react-native-firebase/compare/v12.9.1...v12.9.2) (2021-10-17)
|
17
|
+
|
18
|
+
**Note:** Version bump only for package @react-native-firebase/perf
|
19
|
+
|
20
|
+
## [12.9.1](https://github.com/invertase/react-native-firebase/compare/v12.9.0...v12.9.1) (2021-10-10)
|
21
|
+
|
22
|
+
**Note:** Version bump only for package @react-native-firebase/perf
|
23
|
+
|
6
24
|
# [12.9.0](https://github.com/invertase/react-native-firebase/compare/v12.8.0...v12.9.0) (2021-10-03)
|
7
25
|
|
8
26
|
**Note:** Version bump only for package @react-native-firebase/perf
|
package/android/build.gradle
CHANGED
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// generated by genversion
|
2
|
-
module.exports = '
|
2
|
+
module.exports = '13.0.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/perf",
|
3
|
-
"version": "
|
3
|
+
"version": "13.0.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - React Native Firebase provides native integration with Performance Monitoring to gain insight into key performance characteristics within your React Native application.",
|
6
6
|
"main": "lib/index.js",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
},
|
15
15
|
"repository": {
|
16
16
|
"type": "git",
|
17
|
-
"url": "https://github.com/invertase/react-native-firebase/tree/
|
17
|
+
"url": "https://github.com/invertase/react-native-firebase/tree/main/packages/perf"
|
18
18
|
},
|
19
19
|
"license": "Apache-2.0",
|
20
20
|
"keywords": [
|
@@ -29,13 +29,13 @@
|
|
29
29
|
"performance monitoring"
|
30
30
|
],
|
31
31
|
"peerDependencies": {
|
32
|
-
"@react-native-firebase/app": "
|
32
|
+
"@react-native-firebase/app": "13.0.0"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@expo/config-plugins": "^
|
35
|
+
"@expo/config-plugins": "^4.0.3"
|
36
36
|
},
|
37
37
|
"publishConfig": {
|
38
38
|
"access": "public"
|
39
39
|
},
|
40
|
-
"gitHead": "
|
40
|
+
"gitHead": "4e8e81cca023023332dceeb590f886430ae59016"
|
41
41
|
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { ConfigPlugin, WarningAggregator, withAppBuildGradle } from '@expo/config-plugins';
|
2
|
+
import { perfMonitoringPlugin } from './constants';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Update `app/build.gradle` by applying performance monitoring plugin
|
6
|
+
*/
|
7
|
+
export const withApplyPerfPlugin: ConfigPlugin = config => {
|
8
|
+
return withAppBuildGradle(config, config => {
|
9
|
+
if (config.modResults.language === 'groovy') {
|
10
|
+
config.modResults.contents = applyPlugin(config.modResults.contents);
|
11
|
+
} else {
|
12
|
+
WarningAggregator.addWarningAndroid(
|
13
|
+
'react-native-firebase-perf',
|
14
|
+
`Cannot automatically configure app build.gradle if it's not groovy`,
|
15
|
+
);
|
16
|
+
}
|
17
|
+
return config;
|
18
|
+
});
|
19
|
+
};
|
20
|
+
|
21
|
+
export function applyPlugin(appBuildGradle: string) {
|
22
|
+
const perfPattern = new RegExp(`apply\\s+plugin:\\s+['"]${perfMonitoringPlugin}['"]`);
|
23
|
+
if (!appBuildGradle.match(perfPattern)) {
|
24
|
+
appBuildGradle += `\napply plugin: '${perfMonitoringPlugin}'`;
|
25
|
+
}
|
26
|
+
return appBuildGradle;
|
27
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { ConfigPlugin, WarningAggregator, withProjectBuildGradle } from '@expo/config-plugins';
|
2
|
+
|
3
|
+
import { perfMonitoringClassPath, perfMonitoringVersion } from './constants';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Update `<project>/build.gradle` by adding performance monitoring dependency to buildscript
|
7
|
+
*/
|
8
|
+
export const withBuildscriptDependency: ConfigPlugin = config => {
|
9
|
+
return withProjectBuildGradle(config, config => {
|
10
|
+
if (config.modResults.language === 'groovy') {
|
11
|
+
config.modResults.contents = setBuildscriptDependency(config.modResults.contents);
|
12
|
+
} else {
|
13
|
+
WarningAggregator.addWarningAndroid(
|
14
|
+
'react-native-firebase-perf',
|
15
|
+
`Cannot automatically configure project build.gradle if it's not groovy`,
|
16
|
+
);
|
17
|
+
}
|
18
|
+
return config;
|
19
|
+
});
|
20
|
+
};
|
21
|
+
|
22
|
+
export function setBuildscriptDependency(buildGradle: string) {
|
23
|
+
// TODO: Find a more stable solution for this
|
24
|
+
if (!buildGradle.includes(perfMonitoringClassPath)) {
|
25
|
+
return buildGradle.replace(
|
26
|
+
/dependencies\s?{/,
|
27
|
+
`dependencies {
|
28
|
+
classpath '${perfMonitoringClassPath}:${perfMonitoringVersion}'`,
|
29
|
+
);
|
30
|
+
}
|
31
|
+
|
32
|
+
return buildGradle;
|
33
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
const appPackageJson = require('@react-native-firebase/app/package.json');
|
2
|
+
|
3
|
+
export const perfMonitoringClassPath = 'com.google.firebase:perf-plugin';
|
4
|
+
export const perfMonitoringPlugin = 'com.google.firebase.firebase-perf';
|
5
|
+
export const perfMonitoringVersion = appPackageJson.sdkVersions.android.firebasePerfGradle;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ConfigPlugin, withPlugins, createRunOncePlugin } from '@expo/config-plugins';
|
2
|
+
|
3
|
+
import { withApplyPerfPlugin, withBuildscriptDependency } from './android';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* A config plugin for configuring `@react-native-firebase/perf`
|
7
|
+
*/
|
8
|
+
const withRnFirebasePerf: ConfigPlugin = config => {
|
9
|
+
return withPlugins(config, [withBuildscriptDependency, withApplyPerfPlugin]);
|
10
|
+
};
|
11
|
+
|
12
|
+
const pak = require('@react-native-firebase/perf/package.json');
|
13
|
+
export default createRunOncePlugin(withRnFirebasePerf, pak.name, pak.version);
|