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

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.1",
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,13 +1,41 @@
1
1
  require 'json'
2
2
  require 'rubygems' # Required for version comparison
3
3
 
4
- new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
5
4
 
5
+ new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
6
6
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
7
-
8
7
  podspec_dir = File.dirname(__FILE__)
9
8
 
10
9
  Pod::Spec.new do |s|
10
+
11
+ is_expo_in_podfile = false
12
+ is_version_sufficient = false
13
+ begin
14
+ # Check Podfile for use_expo_modules!
15
+ podfile_path = File.join(Pod::Config.instance.installation_root, 'Podfile')
16
+ if File.exist?(podfile_path)
17
+ podfile_content = File.read(podfile_path)
18
+ is_expo_in_podfile = podfile_content.include?('use_expo_modules!')
19
+ end
20
+ # Check root package.json for Expo version >= 50
21
+ root_package_json_path = File.join(podspec_dir, '..', '..', 'package.json')
22
+ if File.exist?(root_package_json_path)
23
+ pkg_json = JSON.parse(File.read(root_package_json_path))
24
+ expo_version_string = pkg_json['dependencies']&.[]('expo') || pkg_json['devDependencies']&.[]('expo')
25
+ if expo_version_string
26
+ match = expo_version_string.match(/\d+/)
27
+ if match
28
+ major_version = match[0].to_i
29
+ is_version_sufficient = major_version >= 50
30
+ end
31
+ end
32
+ end
33
+ rescue => e
34
+ # Silently ignore errors during check
35
+ end
36
+ # Determine final validity
37
+ valid_expo_project = is_expo_in_podfile && is_version_sufficient
38
+
11
39
  s.name = package['name']
12
40
  s.version = package['version']
13
41
  s.summary = package['description']
@@ -20,7 +48,14 @@ Pod::Spec.new do |s|
20
48
  s.platform = :ios, "8.0"
21
49
  s.platforms = { :ios => "11.0" }
22
50
  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/") }
51
+
52
+ # Conditionally set source files
53
+ if valid_expo_project
54
+ s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}") # Include Expo files
55
+ else
56
+ s.source_files = Dir.glob("ios/**/*.{h,m,mm,swift}").reject { |f| f.start_with?("ios/Expo/") } # Exclude Expo files
57
+ end
58
+
24
59
  s.libraries = 'bz2', 'z'
25
60
  s.vendored_libraries = 'RCTPushy/libRCTPushy.a'
26
61
  s.pod_target_xcconfig = {
@@ -34,46 +69,9 @@ Pod::Spec.new do |s|
34
69
  s.dependency "React-Core"
35
70
  s.dependency 'SSZipArchive'
36
71
 
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
72
+ # Conditionally add Expo dependency
73
+ if valid_expo_project
53
74
  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
75
  end
78
76
 
79
77
  s.subspec 'RCTPushy' do |ss|
@@ -91,7 +89,25 @@ Pod::Spec.new do |s|
91
89
  ss.public_header_files = 'ios/RCTPushy/HDiffPatch/**/*.h'
92
90
  end
93
91
 
94
- if expo_dependency_added
92
+ # Conditionally add Expo subspec and check ExpoModulesCore version
93
+ if valid_expo_project
94
+ supports_bundle_url_final = false # Default
95
+ begin
96
+ # Check installed ExpoModulesCore version for bundle URL support
97
+ expo_core_package_json_path = File.join(podspec_dir, '..', 'expo-modules-core', 'package.json')
98
+ if File.exist?(expo_core_package_json_path)
99
+ core_package_json = JSON.parse(File.read(expo_core_package_json_path))
100
+ installed_version_str = core_package_json['version']
101
+ if installed_version_str
102
+ installed_version = Gem::Version.new(installed_version_str)
103
+ target_version = Gem::Version.new('1.12.0')
104
+ supports_bundle_url_final = installed_version >= target_version
105
+ end
106
+ end
107
+ rescue JSON::ParserError, Errno::ENOENT, ArgumentError, StandardError => e
108
+ # Pod::UI.warn "Could not check ExpoModulesCore version: #{e.message}"
109
+ end
110
+
95
111
  s.subspec 'Expo' do |ss|
96
112
  ss.source_files = 'ios/Expo/**/*.{h,m,mm,swift}'
97
113
  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();