Skip to content

Commit 472c168

Browse files
CHOIMINSEOKelio-wrtnkmsbernard
authored
Add Rn 0.82.1 support (#33)
* drop rn old arch support on android * remove obsolete demo app * remove obsolete demo * add demo rn 0.82.1 * fix test code * fix android reload failure * update ios test template app * use RCTReloadCommandSetBundleURL instead of setValue * add delay before reload to prevent race condition * adjust delay time not breaking test code --------- Co-authored-by: elio <elio@wrtn.io> Co-authored-by: Minsik Kim <kmsbernard@gmail.com>
1 parent 7051220 commit 472c168

File tree

203 files changed

+17015
-47544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+17015
-47544
lines changed

CLAUDE.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
React Native CodePush is a native module that enables over-the-air updates for React Native apps. It consists of native implementations for iOS (Objective-C), Android (Java), and Windows (C++), unified through a JavaScript bridge layer.
8+
9+
## Development Commands
10+
11+
### Testing
12+
- `npm test` - Run all tests with TypeScript compilation
13+
- `npm run test:android` - Run Android-specific tests
14+
- `npm run test:ios` - Run iOS-specific tests
15+
- `npm run test:setup-android` - Set up Android emulator for testing
16+
- `npm run test:setup-ios` - Set up iOS simulator for testing
17+
18+
### Build
19+
- `npm run build` - Build TypeScript tests to bin/ directory
20+
- `npm run tsc` - TypeScript compilation
21+
22+
### Platform Testing
23+
- Tests run on actual emulators/simulators with real React Native apps
24+
- Test apps are created dynamically in `test/` directory
25+
- Both old and new React Native architecture testing supported
26+
27+
## Architecture
28+
29+
### Core Components
30+
- **JavaScript Bridge** (`CodePush.js`): Main API layer exposing update methods
31+
- **Native Modules**: Platform-specific implementations handling file operations, bundle management
32+
- **Update Manager**: Handles download, installation, and rollback logic
33+
- **Acquisition SDK**: Manages server communication and update metadata
34+
35+
### Platform Structure
36+
- **iOS**: `ios/` - Objective-C implementation with CocoaPods integration
37+
- **Android**: `android/` - Java implementation with Gradle plugin
38+
- **Windows**: `windows/` - C++ implementation for Windows React Native
39+
- **JavaScript**: Root level - TypeScript definitions and bridge code
40+
41+
### Key Patterns
42+
- **Higher-Order Component**: `codePush()` wrapper for automatic update management
43+
- **Promise-based Native Bridge**: All native operations return promises
44+
- **Platform Abstraction**: Unified JavaScript API with platform-specific implementations
45+
- **Error Handling**: Automatic rollback on failed updates with telemetry
46+
47+
### Testing Framework
48+
- **Custom Test Runner**: TypeScript-based test framework in `test/`
49+
- **Emulator Management**: Automated setup and teardown of test environments
50+
- **Real App Testing**: Creates actual React Native apps for integration testing
51+
- **Scenario Testing**: Update, rollback, and error scenarios
52+
53+
### Build Integration
54+
- **Android Gradle Plugin**: Automatically generates bundle hashes and processes assets
55+
- **iOS CocoaPods**: Manages native dependencies and build configuration
56+
- **Bundle Processing**: Automated zip creation and hash calculation for OTA updates
57+
58+
## Development Workflow
59+
60+
1. **Making Changes**: Edit native code or JavaScript bridge
61+
2. **Testing**: Run platform-specific tests with real emulators
62+
3. **Integration**: Test with actual React Native apps via test framework
63+
4. **Validation**: Ensure compatibility with both RN architectures
64+
65+
## Key Files
66+
- `CodePush.js` - Main JavaScript API
67+
- `test/TestRunner.ts` - Test framework entry point
68+
- `android/build.gradle` - Android build configuration
69+
- `ios/CodePush.podspec` - iOS CocoaPods specification
70+
- `plugin.xml` - Cordova plugin configuration
71+
72+
## Special Considerations
73+
- Native module requires platform-specific knowledge (iOS/Android/Windows)
74+
- Testing requires emulator setup and can be time-intensive
75+
- Updates must be backward compatible with existing app installations
76+
- Bundle hash calculation is critical for update integrity
File renamed without changes.
File renamed without changes.

Examples/CodePushDemoSwiftNewArch/.gitignore renamed to Examples/CodePushDemo/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ local.properties
3333
.cxx/
3434
*.keystore
3535
!debug.keystore
36+
.kotlin/
3637

3738
# node.js
3839
#
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module.exports = {
22
arrowParens: 'avoid',
3-
bracketSameLine: true,
4-
bracketSpacing: false,
53
singleQuote: true,
64
trailingComma: 'all',
75
};
File renamed without changes.

Examples/CodePushDemo/App.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*
5+
* @format
6+
*/
7+
8+
import { NewAppScreen } from '@react-native/new-app-screen';
9+
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
10+
import {
11+
SafeAreaProvider,
12+
useSafeAreaInsets,
13+
} from 'react-native-safe-area-context';
14+
15+
function App() {
16+
const isDarkMode = useColorScheme() === 'dark';
17+
18+
return (
19+
<SafeAreaProvider>
20+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
21+
<AppContent />
22+
</SafeAreaProvider>
23+
);
24+
}
25+
26+
function AppContent() {
27+
const safeAreaInsets = useSafeAreaInsets();
28+
29+
return (
30+
<View style={styles.container}>
31+
<NewAppScreen
32+
templateFileName="App.tsx"
33+
safeAreaInsets={safeAreaInsets}
34+
/>
35+
</View>
36+
);
37+
}
38+
39+
const styles = StyleSheet.create({
40+
container: {
41+
flex: 1,
42+
},
43+
});
44+
45+
export default App;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
88
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
99
gem 'xcodeproj', '< 1.26.0'
1010
gem 'concurrent-ruby', '< 1.3.4'
11+
12+
# Ruby 3.4.0 has removed some libraries from the standard library.
13+
gem 'bigdecimal'
14+
gem 'logger'
15+
gem 'benchmark'
16+
gem 'mutex_m'

Examples/CodePushDemoSwiftNewArch/Gemfile.lock renamed to Examples/CodePushDemo/Gemfile.lock

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (7.2.2.1)
8+
activesupport (7.2.2.2)
99
base64
1010
benchmark (>= 0.3)
1111
bigdecimal
@@ -23,9 +23,9 @@ GEM
2323
httpclient (~> 2.8, >= 2.8.3)
2424
json (>= 1.5.1)
2525
atomos (0.1.3)
26-
base64 (0.2.0)
27-
benchmark (0.4.0)
28-
bigdecimal (3.1.9)
26+
base64 (0.3.0)
27+
benchmark (0.5.0)
28+
bigdecimal (3.3.1)
2929
claide (1.1.0)
3030
cocoapods (1.15.2)
3131
addressable (~> 2.8)
@@ -66,34 +66,34 @@ GEM
6666
cocoapods-try (1.2.0)
6767
colored2 (3.1.2)
6868
concurrent-ruby (1.3.3)
69-
connection_pool (2.5.0)
70-
drb (2.2.1)
69+
connection_pool (2.5.4)
70+
drb (2.2.3)
7171
escape (0.0.4)
72-
ethon (0.16.0)
72+
ethon (0.15.0)
7373
ffi (>= 1.15.0)
74-
ffi (1.17.1)
74+
ffi (1.17.2)
7575
fourflusher (2.3.1)
7676
fuzzy_match (2.0.4)
7777
gh_inspector (1.1.3)
7878
httpclient (2.9.0)
7979
mutex_m
8080
i18n (1.14.7)
8181
concurrent-ruby (~> 1.0)
82-
json (2.10.1)
83-
logger (1.6.6)
84-
minitest (5.25.4)
82+
json (2.15.2)
83+
logger (1.7.0)
84+
minitest (5.26.0)
8585
molinillo (0.8.0)
8686
mutex_m (0.3.0)
8787
nanaimo (0.3.0)
8888
nap (1.1.0)
8989
netrc (0.11.0)
9090
nkf (0.2.0)
9191
public_suffix (4.0.7)
92-
rexml (3.4.1)
92+
rexml (3.4.4)
9393
ruby-macho (2.5.1)
9494
securerandom (0.4.1)
95-
typhoeus (1.4.1)
96-
ethon (>= 0.9.0)
95+
typhoeus (1.5.0)
96+
ethon (>= 0.9.0, < 0.16.0)
9797
tzinfo (2.0.6)
9898
concurrent-ruby (~> 1.0)
9999
xcodeproj (1.25.1)
@@ -109,12 +109,16 @@ PLATFORMS
109109

110110
DEPENDENCIES
111111
activesupport (>= 6.1.7.5, != 7.1.0)
112+
benchmark
113+
bigdecimal
112114
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
113115
concurrent-ruby (< 1.3.4)
116+
logger
117+
mutex_m
114118
xcodeproj (< 1.26.0)
115119

116120
RUBY VERSION
117-
ruby 3.3.6p108
121+
ruby 3.1.6p260
118122

119123
BUNDLED WITH
120-
2.6.2
124+
2.5.9
File renamed without changes.

0 commit comments

Comments
 (0)