setupad-prebid-react-native 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/app.plugin.js +18 -39
  2. package/package.json +1 -1
package/app.plugin.js CHANGED
@@ -1,57 +1,41 @@
1
- const { withDangerousMod, withPlugins } = require('@expo/config-plugins');
1
+ const { withDangerousMod } = require('@expo/config-plugins');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
 
5
5
  /**
6
6
  * Expo config plugin for setupad-prebid-react-native
7
7
  *
8
- * Automatically configures the consumer's iOS project with:
9
- * - use_frameworks! :linkage => :static (via Podfile.properties.json)
8
+ * Automatically configures the consumer's iOS Podfile with:
9
+ * - use_frameworks! :linkage => :static (required for Swift module resolution)
10
10
  * - Explicit VeonPrebid pod dependencies
11
11
  * - post_install hooks for DEFINES_MODULE and Swift module resolution
12
12
  */
13
-
14
- /**
15
- * Ensures ios.useFrameworks is set to "static" in Podfile.properties.json.
16
- * This is required for VeonPrebidMobile Swift module resolution.
17
- */
18
- function withUseFrameworks(config) {
13
+ module.exports = function withVeonPrebid(config) {
19
14
  return withDangerousMod(config, [
20
15
  'ios',
21
16
  async (cfg) => {
22
- const propsPath = path.join(
17
+ const podfilePath = path.join(
23
18
  cfg.modRequest.platformProjectRoot,
24
- 'Podfile.properties.json'
19
+ 'Podfile'
25
20
  );
26
21
 
27
- let props = {};
28
- if (fs.existsSync(propsPath)) {
29
- props = JSON.parse(fs.readFileSync(propsPath, 'utf8'));
30
- }
31
-
32
- if (props['ios.useFrameworks'] !== 'static') {
33
- props['ios.useFrameworks'] = 'static';
34
- fs.writeFileSync(propsPath, JSON.stringify(props, null, 2) + '\n');
35
- }
36
-
37
- return cfg;
38
- },
39
- ]);
40
- }
41
-
42
- function withVeonPrebidIOS(config) {
43
- return withDangerousMod(config, [
44
- 'ios',
45
- async (cfg) => {
46
- const podfilePath = path.join(cfg.modRequest.platformProjectRoot, 'Podfile');
47
-
48
22
  if (!fs.existsSync(podfilePath)) {
49
23
  return cfg;
50
24
  }
51
25
 
52
26
  let podfile = fs.readFileSync(podfilePath, 'utf8');
53
27
 
54
- // Add explicit Veon Prebid pod dependencies if not already present
28
+ // 1. Add use_frameworks! directly in Podfile
29
+ // Cannot rely on Podfile.properties.json because pod install reads it
30
+ // BEFORE dangerous mods write to it during first prebuild.
31
+ if (!podfile.includes("use_frameworks! :linkage => :static")) {
32
+ podfile = podfile.replace(
33
+ /use_react_native!\(/,
34
+ `use_frameworks! :linkage => :static\n\n use_react_native!(`
35
+ );
36
+ }
37
+
38
+ // 2. Add explicit Veon Prebid pod dependencies
55
39
  if (!podfile.includes("pod 'VeonPrebidMobile'")) {
56
40
  podfile = podfile.replace(
57
41
  /use_react_native!\(/,
@@ -59,7 +43,7 @@ function withVeonPrebidIOS(config) {
59
43
  );
60
44
  }
61
45
 
62
- // Add post_install hook for VeonPrebid module fixes
46
+ // 3. Add post_install hook for VeonPrebid module fixes
63
47
  if (!podfile.includes('VeonPrebidMobile Swift module')) {
64
48
  const postInstallHook = `
65
49
  # Fix for VeonPrebidMobile Swift module resolution
@@ -74,7 +58,6 @@ function withVeonPrebidIOS(config) {
74
58
  end
75
59
  end`;
76
60
 
77
- // Insert before the last `end` of post_install block
78
61
  podfile = podfile.replace(
79
62
  /(react_native_post_install\([^)]*\)[\s\S]*?\))/,
80
63
  `$1\n${postInstallHook}`
@@ -85,8 +68,4 @@ function withVeonPrebidIOS(config) {
85
68
  return cfg;
86
69
  },
87
70
  ]);
88
- }
89
-
90
- module.exports = function withVeonPrebid(config) {
91
- return withPlugins(config, [withUseFrameworks, withVeonPrebidIOS]);
92
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setupad-prebid-react-native",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Prebid SDK for React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "expo": {