react-native-update 10.28.4 → 10.28.5-beta.0

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.
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>react-native-update</name>
4
+ <comment>Project react-native-update created by Buildship.</comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16
+ </natures>
17
+ <filteredResources>
18
+ <filter>
19
+ <id>1727963310481</id>
20
+ <name></name>
21
+ <type>30</type>
22
+ <matcher>
23
+ <id>org.eclipse.core.resources.regexFilterMatcher</id>
24
+ <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25
+ </matcher>
26
+ </filter>
27
+ </filteredResources>
28
+ </projectDescription>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>react-native-update</name>
4
+ <comment>Project react-native-update created by Buildship.</comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.jdt.core.javabuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ <buildCommand>
14
+ <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
15
+ <arguments>
16
+ </arguments>
17
+ </buildCommand>
18
+ </buildSpec>
19
+ <natures>
20
+ <nature>org.eclipse.jdt.core.javanature</nature>
21
+ <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
22
+ </natures>
23
+ <filteredResources>
24
+ <filter>
25
+ <id>1727963310481</id>
26
+ <name></name>
27
+ <type>30</type>
28
+ <matcher>
29
+ <id>org.eclipse.core.resources.regexFilterMatcher</id>
30
+ <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31
+ </matcher>
32
+ </filter>
33
+ </filteredResources>
34
+ </projectDescription>
@@ -0,0 +1,13 @@
1
+ arguments=--init-script /var/folders/l6/0fn3x28s5s585ld3p04gsy1h0000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle --init-script /var/folders/l6/0fn3x28s5s585ld3p04gsy1h0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
2
+ auto.sync=false
3
+ build.scans.enabled=false
4
+ connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(8.9))
5
+ connection.project.dir=
6
+ eclipse.preferences.version=1
7
+ gradle.user.home=
8
+ java.home=/Users/sunny/.sdkman/candidates/java/17.0.9-zulu/zulu-17.jdk/Contents/Home
9
+ jvm.arguments=
10
+ offline.mode=false
11
+ override.workspace.settings=true
12
+ show.console.view=true
13
+ show.executions.view=true
@@ -22,21 +22,49 @@ def supportsNamespace() {
22
22
  return major >= 8
23
23
  }
24
24
 
25
- def isExpoProject() {
25
+ def checkProjectInfo() {
26
26
  def hasExpoModulesCore = rootProject.subprojects.any { it.name == 'expo-modules-core' }
27
-
28
27
  def packageJsonFile = new File(rootProject.projectDir.parentFile, 'package.json')
28
+
29
29
  def hasExpoDependency = false
30
+ def projectVersion = '1.0.0' // Default version
31
+
30
32
  if (packageJsonFile.exists()) {
31
33
  def packageJson = new groovy.json.JsonSlurper().parseText(packageJsonFile.text)
32
- hasExpoDependency = (packageJson.dependencies?.expo != null) ||
33
- (packageJson.devDependencies?.expo != null)
34
+ projectVersion = packageJson.version ?: '1.0.0' // Get project version
35
+
36
+ // Check for expo dependency and version >= 50
37
+ String expoVersionString = packageJson.dependencies?.expo ?: packageJson.devDependencies?.expo
38
+ boolean expoVersionIsHighEnough = false
39
+ if (expoVersionString) {
40
+ try {
41
+ // Extract the first number sequence as the major version
42
+ def matcher = (expoVersionString =~ /(\d+)/)
43
+ if (matcher.find()) {
44
+ int majorVersion = matcher[0][0].toInteger()
45
+ if (majorVersion >= 50) {
46
+ expoVersionIsHighEnough = true
47
+ }
48
+ }
49
+ } catch (NumberFormatException e) {
50
+ // Handle error if version parsing fails, maybe log a warning
51
+ println "Warning: Could not parse Expo version string: ${expoVersionString}"
52
+ }
53
+ }
54
+ hasExpoDependency = expoVersionIsHighEnough // Update based on version check
34
55
  }
35
56
 
36
- return hasExpoModulesCore || hasExpoDependency
57
+ def isExpo = hasExpoModulesCore && hasExpoDependency
58
+
59
+ // Return a map containing both pieces of information
60
+ return [isExpo: isExpo, version: projectVersion]
37
61
  }
38
62
 
39
- def expoProject = isExpoProject()
63
+ // Get project info map
64
+ def projectInfo = checkProjectInfo()
65
+ // Extract info into variables
66
+ def projectVersion = projectInfo.version
67
+ def expoProject = projectInfo.isExpo
40
68
 
41
69
  apply plugin: 'com.android.library'
42
70
  if (isNewArchitectureEnabled()) {
@@ -45,16 +73,16 @@ if (isNewArchitectureEnabled()) {
45
73
 
46
74
  if (expoProject) {
47
75
  group = 'expo.modules.pushy'
48
- version = '1.0.0'
76
+ version = projectVersion
49
77
 
50
78
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
51
79
  apply from: expoModulesCorePlugin
52
80
  applyKotlinExpoModulesCorePlugin()
53
- useCoreDependencies()
54
81
  useExpoPublishing()
82
+ useCoreDependencies()
55
83
  } else {
56
84
  group = 'cn.reactnative.modules.update'
57
- version = '1.0.0'
85
+ version = projectVersion
58
86
  }
59
87
 
60
88
  android {
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "react-native-update",
3
- "version": "10.28.4",
3
+ "version": "10.28.5-beta.0",
4
4
  "description": "react-native hot update",
5
5
  "main": "src/index",
6
6
  "scripts": {
7
+ "postinstall": "node scripts/check-expo-version.js",
7
8
  "prepack": "yarn submodule && yarn lint",
8
9
  "lint": "eslint \"src/*.@(ts|tsx|js|jsx)\" && tsc --noEmit",
9
10
  "submodule": "git submodule update --init --recursive",
@@ -1,12 +1,64 @@
1
1
  require 'json'
2
2
  require 'rubygems' # Required for version comparison
3
3
 
4
- new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
4
+ # Helper function to check Expo version in a package.json
5
+ def check_expo_version(package_json_path)
6
+ begin
7
+ package_json = JSON.parse(File.read(package_json_path))
8
+ # Check both dependencies and devDependencies
9
+ expo_version_string = package_json['dependencies']&.[]('expo') || package_json['devDependencies']&.[]('expo')
10
+
11
+ if expo_version_string
12
+ # Extract the first number sequence as the major version
13
+ match = expo_version_string.match(/\d+/)
14
+ if match
15
+ major_version = match[0].to_i
16
+ return major_version >= 50
17
+ else
18
+ # Pod::UI.warn "Could not parse major version from Expo version string: #{expo_version_string}"
19
+ end
20
+ end
21
+ rescue JSON::ParserError, Errno::ENOENT, StandardError => e
22
+ # Log error or handle gracefully if package.json is missing or invalid
23
+ # Pod::UI.warn "Could not check Expo version from #{package_json_path}: #{e.message}"
24
+ end
25
+ return false # Default to false if not found or error
26
+ end
5
27
 
6
- package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
28
+ # Function to determine if it's a valid Expo project (Podfile check + Version Check)
29
+ def is_valid_expo_project(podspec_dir)
30
+ is_expo_in_podfile = false
31
+ # Check Podfile for use_expo_modules!
32
+ begin
33
+ # Use CocoaPods mechanism to find Podfile relative to installation root
34
+ podfile_path = File.join(Pod::Config.instance.installation_root, 'Podfile')
35
+ if File.exist?(podfile_path)
36
+ podfile_content = File.read(podfile_path)
37
+ is_expo_in_podfile = podfile_content.include?('use_expo_modules!')
38
+ else
39
+ # Pod::UI.warn "Podfile not found at expected location: #{podfile_path}"
40
+ end
41
+ rescue => e
42
+ # Silently skip if CocoaPods config is not available or other error
43
+ # Pod::UI.warn "Could not check Podfile for use_expo_modules!: #{e.message}"
44
+ end
45
+
46
+ # Check root package.json for Expo version >= 50
47
+ # Assumes podspec is in node_modules/react-native-update
48
+ root_package_json_path = File.join(podspec_dir, '..', '..', 'package.json')
49
+ is_version_sufficient = check_expo_version(root_package_json_path)
50
+
51
+ # Both conditions must be true
52
+ return is_expo_in_podfile && is_version_sufficient
53
+ end
7
54
 
55
+ new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
56
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
8
57
  podspec_dir = File.dirname(__FILE__)
9
58
 
59
+ # Determine if it's a valid Expo project based on Podfile and package.json version
60
+ valid_expo_project = is_valid_expo_project(podspec_dir)
61
+
10
62
  Pod::Spec.new do |s|
11
63
  s.name = package['name']
12
64
  s.version = package['version']
@@ -20,7 +72,14 @@ Pod::Spec.new do |s|
20
72
  s.platform = :ios, "8.0"
21
73
  s.platforms = { :ios => "11.0" }
22
74
  s.source = { :git => 'https://github.com/reactnativecn/react-native-update.git', :tag => '#{s.version}' }
23
- s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}").reject { |f| f.start_with?("ios/Expo/") }
75
+
76
+ # Conditionally set source files
77
+ if valid_expo_project
78
+ s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}") # Include Expo files
79
+ else
80
+ s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}").reject { |f| f.start_with?("ios/Expo/") } # Exclude Expo files
81
+ end
82
+
24
83
  s.libraries = 'bz2', 'z'
25
84
  s.vendored_libraries = 'RCTPushy/libRCTPushy.a'
26
85
  s.pod_target_xcconfig = {
@@ -34,46 +93,9 @@ Pod::Spec.new do |s|
34
93
  s.dependency "React-Core"
35
94
  s.dependency 'SSZipArchive'
36
95
 
37
- is_expo_project = false
38
- expo_dependency_added = false
39
- supports_bundle_url_final = false
40
-
41
- # Use CocoaPods mechanism to find Podfile
42
- begin
43
- podfile_path = File.join(Pod::Config.instance.installation_root, 'Podfile')
44
- if File.exist?(podfile_path)
45
- podfile_content = File.read(podfile_path)
46
- is_expo_project = podfile_content.include?('use_expo_modules!')
47
- end
48
- rescue
49
- # Silently skip if CocoaPods config is not available
50
- end
51
-
52
- if is_expo_project
96
+ # Conditionally add Expo dependency
97
+ if valid_expo_project
53
98
  s.dependency 'ExpoModulesCore'
54
- expo_dependency_added = true
55
-
56
- # Current directory is in node_modules/react-native-update, so parent is node_modules
57
- expo_core_package_json_path = File.join(__dir__, '..', 'expo-modules-core', 'package.json')
58
-
59
- if File.exist?(expo_core_package_json_path)
60
- begin
61
- core_package_json = JSON.parse(File.read(expo_core_package_json_path))
62
- installed_version_str = core_package_json['version']
63
-
64
- if installed_version_str
65
- begin
66
- installed_version = Gem::Version.new(installed_version_str)
67
- target_version = Gem::Version.new('1.12.0')
68
- supports_bundle_url_final = installed_version >= target_version
69
- rescue ArgumentError
70
- # Silently skip version parsing errors
71
- end
72
- end
73
- rescue JSON::ParserError, StandardError
74
- # Silently skip file reading and parsing errors
75
- end
76
- end
77
99
  end
78
100
 
79
101
  s.subspec 'RCTPushy' do |ss|
@@ -91,7 +113,25 @@ Pod::Spec.new do |s|
91
113
  ss.public_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
92
114
  end
93
115
 
94
- if expo_dependency_added
116
+ # Conditionally add Expo subspec and check ExpoModulesCore version
117
+ if valid_expo_project
118
+ supports_bundle_url_final = false # Default
119
+ begin
120
+ # Check installed ExpoModulesCore version for bundle URL support
121
+ expo_core_package_json_path = File.join(podspec_dir, '..', 'expo-modules-core', 'package.json')
122
+ if File.exist?(expo_core_package_json_path)
123
+ core_package_json = JSON.parse(File.read(expo_core_package_json_path))
124
+ installed_version_str = core_package_json['version']
125
+ if installed_version_str
126
+ installed_version = Gem::Version.new(installed_version_str)
127
+ target_version = Gem::Version.new('1.12.0')
128
+ supports_bundle_url_final = installed_version >= target_version
129
+ end
130
+ end
131
+ rescue JSON::ParserError, Errno::ENOENT, ArgumentError, StandardError => e
132
+ # Pod::UI.warn "Could not check ExpoModulesCore version: #{e.message}"
133
+ end
134
+
95
135
  s.subspec 'Expo' do |ss|
96
136
  ss.source_files = 'ios/Expo/**/*.{h,m,mm,swift}'
97
137
  if supports_bundle_url_final
@@ -0,0 +1,85 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const projectRoot = path.resolve(__dirname, '..'); // react-native-update module root
5
+ const expoConfigPath = path.resolve(projectRoot, 'expo-module.config.json');
6
+
7
+ function getExpoMajorVersion() {
8
+ let resolvedExpoPackagePath;
9
+ try {
10
+ // Use require.resolve to find expo's package.json from the host project's perspective
11
+ resolvedExpoPackagePath = require.resolve('expo/package.json', {
12
+ paths: [path.resolve(projectRoot, '..', '..')],
13
+ });
14
+ } catch (e) {
15
+ console.log(
16
+ 'Expo not found in project node_modules (via require.resolve).',
17
+ );
18
+ return null; // Expo not found or resolvable
19
+ }
20
+
21
+ // Check if the resolved path actually exists (belt-and-suspenders)
22
+ if (!fs.existsSync(resolvedExpoPackagePath)) {
23
+ console.log(
24
+ `Expo package.json path resolved to ${resolvedExpoPackagePath}, but file does not exist.`,
25
+ );
26
+ return null;
27
+ }
28
+
29
+ try {
30
+ const packageJson = JSON.parse(
31
+ fs.readFileSync(resolvedExpoPackagePath, 'utf8'),
32
+ );
33
+ const version = packageJson.version;
34
+ if (!version) {
35
+ console.log('Expo package.json does not contain a version.');
36
+ return null; // Version not found
37
+ }
38
+
39
+ // Extract the first number sequence as the major version
40
+ const match = version.match(/\d+/);
41
+ if (!match) {
42
+ console.log(
43
+ `Could not parse major version from Expo version string: ${version}`,
44
+ );
45
+ return null; // Cannot parse version
46
+ }
47
+
48
+ return parseInt(match[0], 10);
49
+ } catch (error) {
50
+ console.error('Error reading or parsing Expo package.json:', error);
51
+ return null; // Error during processing
52
+ }
53
+ }
54
+
55
+ function checkAndCleanExpoConfig() {
56
+ const majorVersion = getExpoMajorVersion();
57
+
58
+ // Condition: Expo not found OR major version is less than 50
59
+ if (majorVersion === null || majorVersion < 50) {
60
+ if (fs.existsSync(expoConfigPath)) {
61
+ try {
62
+ fs.unlinkSync(expoConfigPath);
63
+ console.log(
64
+ `Expo version (${
65
+ majorVersion !== null ? majorVersion : 'not found'
66
+ }) is < 50 or Expo not found. Deleted ${expoConfigPath}`,
67
+ );
68
+ } catch (error) {
69
+ console.error(`Failed to delete ${expoConfigPath}:`, error);
70
+ }
71
+ } else {
72
+ console.log(
73
+ `Expo version (${
74
+ majorVersion !== null ? majorVersion : 'not found'
75
+ }) is < 50 or Expo not found. ${expoConfigPath} does not exist, no action needed.`,
76
+ );
77
+ }
78
+ } else {
79
+ console.log(
80
+ `Expo version (${majorVersion}) is >= 50. Kept ${expoConfigPath}`,
81
+ );
82
+ }
83
+ }
84
+
85
+ checkAndCleanExpoConfig();