react-native-candle 0.1.1 → 0.1.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-candle",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Candle SDK for React Native",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -1,45 +1,64 @@
1
- const { withDangerousMod } = require("@expo/config-plugins");
1
+ const {
2
+ withDangerousMod,
3
+ withXcodeProject,
4
+ withPlugins,
5
+ } = require("@expo/config-plugins");
2
6
  const {
3
7
  mergeContents,
4
8
  } = require("@expo/config-plugins/build/utils/generateCode");
5
9
  const fs = require("fs");
6
10
  const path = require("path");
7
11
 
8
- const withIosDeploymentTarget = (config) => {
9
- return withDangerousMod(config, [
10
- "ios",
11
- async (config) => {
12
- // Find the Podfile
13
- const podfile = path.join(
14
- config.modRequest.platformProjectRoot,
15
- "Podfile"
16
- );
17
- // Read the Podfile
18
- const podfileContents = fs.readFileSync(podfile, "utf8");
19
- // Merge the contents of the Podfile with the new content setting
20
- // the deployment target of all targets to 17.0
21
- const setDeploymentTarget = mergeContents({
22
- tag: "ios-deployment-target",
23
- src: podfileContents,
24
- newSrc: ` installer.pods_project.targets.each do |target|
12
+ const plugin = (config, options = {}) => {
13
+ return withPlugins(config, [
14
+ [
15
+ withDangerousMod,
16
+ [
17
+ "ios",
18
+ async (config) => {
19
+ return withIosDeploymentTarget(config);
20
+ },
21
+ ],
22
+ ],
23
+ [
24
+ withXcodeProject,
25
+ async (config) => {
26
+ return withMyCustomBuildPhase(config);
27
+ },
28
+ ],
29
+ ]);
30
+ };
31
+
32
+ // This function sets the iOS deployment target to 17.0
33
+ const withIosDeploymentTarget = async (config) => {
34
+ // Find the Podfile
35
+ const podfile = path.join(config.modRequest.platformProjectRoot, "Podfile");
36
+ // Read the Podfile
37
+ const podfileContents = fs.readFileSync(podfile, "utf8");
38
+ // Merge the contents of the Podfile with the new content setting
39
+ // the deployment target of all targets to 17.0
40
+ const setDeploymentTarget = mergeContents({
41
+ tag: "ios-deployment-target",
42
+ src: podfileContents,
43
+ newSrc: ` installer.pods_project.targets.each do |target|
25
44
  target.build_configurations.each do |config|
26
45
  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '17.0'
27
46
  end
28
47
  end`,
29
- anchor: /post_install do \|installer\|/i,
30
- offset: 1,
31
- comment: "#",
32
- });
48
+ anchor: /post_install do \|installer\|/i,
49
+ offset: 1,
50
+ comment: "#",
51
+ });
33
52
 
34
- if (!setDeploymentTarget.didMerge) {
35
- console.log("Failed to set iOS deployment target");
36
- return config;
37
- }
53
+ if (!setDeploymentTarget.didMerge) {
54
+ console.log("Failed to set iOS deployment target");
55
+ return config;
56
+ }
38
57
 
39
- const setPreInstallHook = mergeContents({
40
- tag: "rnreanimated-preinstall",
41
- src: setDeploymentTarget.contents,
42
- newSrc: ` pre_install do |installer|
58
+ const setPreInstallHook = mergeContents({
59
+ tag: "rnreanimated-preinstall",
60
+ src: setDeploymentTarget.contents,
61
+ newSrc: ` pre_install do |installer|
43
62
  installer.pod_targets.each do |pod|
44
63
  if pod.name.eql?('RNReanimated')
45
64
  def pod.build_type;
@@ -49,21 +68,46 @@ const withIosDeploymentTarget = (config) => {
49
68
  end
50
69
  end
51
70
  end`,
52
- anchor: /post_install do \|installer\|/i,
53
- offset: 0,
54
- comment: "#",
55
- });
71
+ anchor: /post_install do \|installer\|/i,
72
+ offset: 0,
73
+ comment: "#",
74
+ });
56
75
 
57
- if (!setPreInstallHook.didMerge) {
58
- console.log("Failed to insert RNReanimated pre_install hook");
59
- return config;
60
- }
76
+ if (!setPreInstallHook.didMerge) {
77
+ console.log("Failed to insert RNReanimated pre_install hook");
78
+ return config;
79
+ }
61
80
 
62
- fs.writeFileSync(podfile, setPreInstallHook.contents);
81
+ fs.writeFileSync(podfile, setPreInstallHook.contents);
63
82
 
64
- return config;
65
- },
66
- ]);
83
+ return config;
84
+ };
85
+
86
+ // This function adds a custom build phase to the Xcode project
87
+ // that removes signature files from the build directory
88
+ // for Xcode 15 and 16. This is a workaround for a known issue
89
+ // with these versions of Xcode.
90
+ // I think it's because of the duplicate symbol issue.
91
+ const withMyCustomBuildPhase = async (config) => {
92
+ const xcodeProject = config.modResults;
93
+ const shellScript = `if { [ "$XCODE_VERSION_MAJOR" = "1500" ] || [ "$XCODE_VERSION_MAJOR" = "1600" ]; } && [ "$CONFIGURATION" = "Release" ]; then
94
+ echo "Remove signature files (Xcode 15/16 workaround, only in Release)"
95
+ find "$BUILD_DIR/\${CONFIGURATION}-iphoneos" -name "*.signature" -type f | xargs -r rm
96
+ fi`;
97
+
98
+ xcodeProject.addBuildPhase(
99
+ [],
100
+ "PBXShellScriptBuildPhase",
101
+ "Remove Framework signature files (Xcode 15/16 workaround)",
102
+ null,
103
+ {
104
+ shellPath: "/bin/sh",
105
+ shellScript,
106
+ runOnlyForDeploymentPostprocessing: 1,
107
+ }
108
+ );
109
+
110
+ return config;
67
111
  };
68
112
 
69
- module.exports = withIosDeploymentTarget;
113
+ module.exports = plugin;