@revopush/react-native-code-push 2.5.0 → 2.5.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/.claude/settings.local.json +5 -1
- package/README.md +2 -1
- package/android/build.gradle +12 -1
- package/android/codepush.gradle +21 -44
- package/android/gradle.properties +2 -0
- package/android/proguard-rules.pro +18 -2
- package/android/settings.gradle +8 -9
- package/android/src/main/java/com/microsoft/codepush/react/BaseBundleStore.java +78 -0
- package/android/src/main/java/com/microsoft/codepush/react/CodePush.java +15 -4
- package/android/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +2 -0
- package/android/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +74 -18
- package/android/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +56 -11
- package/android/src/main/java/com/microsoft/codepush/react/FileUtils.java +7 -5
- package/docs/setup-android.md +27 -1
- package/ios/CodePush/CodePush.h +14 -0
- package/ios/CodePush/CodePush.m +17 -44
- package/ios/CodePush/CodePushBaseBundleStore.m +104 -0
- package/ios/CodePush/CodePushPackage.m +82 -9
- package/ios/CodePush/CodePushUpdateUtils.m +14 -9
- package/ios/CodePush.xcodeproj/project.pbxproj +6 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/DiffUpdates +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/DiffUpdates.h +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/hpatch_objc.h +23 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Info.plist +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/DiffUpdates +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Headers/DiffUpdates.h +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Headers/hpatch_objc.h +23 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Info.plist +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeResources +12 -9
- package/package.json +10 -14
- package/tsconfig.json +1 -4
- package/typings/react-native-code-push.d.ts +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/scripts/postlink/android/postlink.js +0 -87
- package/scripts/postlink/ios/postlink.js +0 -116
- package/scripts/postlink/run.js +0 -11
- package/scripts/postunlink/android/postunlink.js +0 -74
- package/scripts/postunlink/ios/postunlink.js +0 -87
- package/scripts/postunlink/run.js +0 -11
- package/scripts/tools/linkToolsAndroid.js +0 -57
- package/scripts/tools/linkToolsIos.js +0 -130
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
6463C82E1EBA0CFB0095B8CD /* CodePush.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* CodePush.m */; };
|
|
82
82
|
6463C82F1EBA0CFB0095B8CD /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; };
|
|
83
83
|
6463C8321EBA0CFB0095B8CD /* CodePushPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D4E6C1B96935000B397E9 /* CodePushPackage.m */; };
|
|
84
|
+
BA5EB00D0000000000000003 /* CodePushBaseBundleStore.m in Sources */ = {isa = PBXBuildFile; fileRef = BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */; };
|
|
84
85
|
6463C8331EBA0CFB0095B8CD /* CodePushTelemetryManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */; };
|
|
85
86
|
6463C8341EBA0CFB0095B8CD /* CodePushUpdateUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */; };
|
|
86
87
|
6463C8351EBA0CFB0095B8CD /* RCTConvert+CodePushInstallMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */; };
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
6463C8451EBA0D1F0095B8CD /* CodePush.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
89
90
|
6463C8471EBA0D290095B8CD /* CodePush.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
90
91
|
810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D4E6C1B96935000B397E9 /* CodePushPackage.m */; };
|
|
92
|
+
BA5EB00D0000000000000002 /* CodePushBaseBundleStore.m in Sources */ = {isa = PBXBuildFile; fileRef = BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */; };
|
|
91
93
|
81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; };
|
|
92
94
|
8482F84C1E24C58300F793DB /* CodePush.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
93
95
|
8482F84E1E24C66300F793DB /* CodePush.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
@@ -210,6 +212,7 @@
|
|
|
210
212
|
540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushUpdateUtils.m; path = CodePush/CodePushUpdateUtils.m; sourceTree = "<group>"; };
|
|
211
213
|
5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushTelemetryManager.m; path = CodePush/CodePushTelemetryManager.m; sourceTree = "<group>"; };
|
|
212
214
|
810D4E6C1B96935000B397E9 /* CodePushPackage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushPackage.m; path = CodePush/CodePushPackage.m; sourceTree = "<group>"; };
|
|
215
|
+
BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushBaseBundleStore.m; path = CodePush/CodePushBaseBundleStore.m; sourceTree = "<group>"; };
|
|
213
216
|
81D51F391B6181C2000DA084 /* CodePushConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushConfig.m; path = CodePush/CodePushConfig.m; sourceTree = "<group>"; };
|
|
214
217
|
F85736731F4F03BF00C9C00A /* MF_Base64Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MF_Base64Additions.h; sourceTree = "<group>"; };
|
|
215
218
|
F85736741F4F03BF00C9C00A /* MF_Base64Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MF_Base64Additions.m; sourceTree = "<group>"; };
|
|
@@ -370,6 +373,7 @@
|
|
|
370
373
|
13BE3DED1AC21097009241FE /* CodePush.m */,
|
|
371
374
|
81D51F391B6181C2000DA084 /* CodePushConfig.m */,
|
|
372
375
|
810D4E6C1B96935000B397E9 /* CodePushPackage.m */,
|
|
376
|
+
BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */,
|
|
373
377
|
5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */,
|
|
374
378
|
540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */,
|
|
375
379
|
1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */,
|
|
@@ -763,6 +767,7 @@
|
|
|
763
767
|
F88664511F4AD1EE0036D01B /* JWTAlgorithmNone.m in Sources */,
|
|
764
768
|
3221E4612C8ABE1300268379 /* mz_zip_rw.c in Sources */,
|
|
765
769
|
810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */,
|
|
770
|
+
BA5EB00D0000000000000002 /* CodePushBaseBundleStore.m in Sources */,
|
|
766
771
|
3221E4552C8ABE1300268379 /* mz_strm_pkcrypt.c in Sources */,
|
|
767
772
|
F88664531F4AD1EE0036D01B /* JWTAlgorithmESBase.m in Sources */,
|
|
768
773
|
3221E4532C8ABE1300268379 /* mz_strm_os_posix.c in Sources */,
|
|
@@ -783,6 +788,7 @@
|
|
|
783
788
|
6463C82F1EBA0CFB0095B8CD /* CodePushConfig.m in Sources */,
|
|
784
789
|
3221E46E2C8ABE1300268379 /* mz_crypt.c in Sources */,
|
|
785
790
|
6463C8321EBA0CFB0095B8CD /* CodePushPackage.m in Sources */,
|
|
791
|
+
BA5EB00D0000000000000003 /* CodePushBaseBundleStore.m in Sources */,
|
|
786
792
|
6463C8331EBA0CFB0095B8CD /* CodePushTelemetryManager.m in Sources */,
|
|
787
793
|
6463C8341EBA0CFB0095B8CD /* CodePushUpdateUtils.m in Sources */,
|
|
788
794
|
3221E45C2C8ABE1300268379 /* mz_strm_zlib.c in Sources */,
|
|
Binary file
|
package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/DiffUpdates.h
CHANGED
|
@@ -8,6 +8,12 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
8
8
|
|
|
9
9
|
// In this header, you should import all the public headers of your framework using statements like #import <DiffUpdates/PublicHeader.h>
|
|
10
10
|
|
|
11
|
+
#if __has_include(<DiffUpdates/hpatch_objc.h>)
|
|
12
|
+
#import <DiffUpdates/hpatch_objc.h>
|
|
13
|
+
#else
|
|
14
|
+
#import "hpatch_objc.h"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
11
17
|
@interface CodePushDownloadHandler : NSObject <NSURLConnectionDelegate>
|
|
12
18
|
|
|
13
19
|
@property (strong) NSOutputStream *outputFileStream;
|
|
@@ -43,6 +49,18 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
43
49
|
doneCallback:(void (^)(BOOL))doneCallback
|
|
44
50
|
failCallback:(void (^)(NSError *err))failCallback;
|
|
45
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Patches against baseBundlePath, or against the binary's own bundle when it is nil.
|
|
54
|
+
* The patched bundle always keeps the binary bundle's file name, whatever the base was.
|
|
55
|
+
*/
|
|
56
|
+
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
57
|
+
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
58
|
+
assetHash:(NSString * _Nullable)assetHash
|
|
59
|
+
nativeAssetHash:(NSString * _Nullable)nativeAssetHash
|
|
60
|
+
currentPackage:(NSDictionary * _Nullable)currentPackage
|
|
61
|
+
baseBundlePath:(NSString * _Nullable)baseBundlePath;
|
|
62
|
+
|
|
63
|
+
/** Patches against the binary's own bundle. Kept so an older SDK links against a newer framework. */
|
|
46
64
|
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
47
65
|
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
48
66
|
assetHash:(NSString * _Nullable)assetHash
|
package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/hpatch_objc.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
@interface hpatcher : NSObject
|
|
4
|
+
|
|
5
|
+
// return THPatchResult, 0 is ok
|
|
6
|
+
// cacheMemory:
|
|
7
|
+
// cacheMemory is used for file IO, different cacheMemory only affects patch speed;
|
|
8
|
+
// recommended 256*1024,1024*1024,... if cacheMemory<0 then default 256*1024;
|
|
9
|
+
// NOTE: if diffFile created by $xdelta3(-S,-S lzma),$open-vcdiff, alloc memory+=sourceWindowSize+targetWindowSize;
|
|
10
|
+
// ( sourceWindowSize & targetWindowSize is set when diff, C API getVcDiffInfo() can got values from diffFile. )
|
|
11
|
+
// if diffFile created by $bsdiff4, and patch very slow,
|
|
12
|
+
// then cacheMemory recommended oldFileSize+256*1024;
|
|
13
|
+
|
|
14
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
15
|
+
withDiff:(NSString *)diffFileName
|
|
16
|
+
toNew:(NSString *)outNewFileName;
|
|
17
|
+
|
|
18
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
19
|
+
withDiff:(NSString *)diffFileName
|
|
20
|
+
toNew:(NSString *)outNewFileName
|
|
21
|
+
byMemory:(int64_t)cacheMemory;
|
|
22
|
+
|
|
23
|
+
@end
|
|
Binary file
|
|
Binary file
|
|
@@ -8,6 +8,12 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
8
8
|
|
|
9
9
|
// In this header, you should import all the public headers of your framework using statements like #import <DiffUpdates/PublicHeader.h>
|
|
10
10
|
|
|
11
|
+
#if __has_include(<DiffUpdates/hpatch_objc.h>)
|
|
12
|
+
#import <DiffUpdates/hpatch_objc.h>
|
|
13
|
+
#else
|
|
14
|
+
#import "hpatch_objc.h"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
11
17
|
@interface CodePushDownloadHandler : NSObject <NSURLConnectionDelegate>
|
|
12
18
|
|
|
13
19
|
@property (strong) NSOutputStream *outputFileStream;
|
|
@@ -43,6 +49,18 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
43
49
|
doneCallback:(void (^)(BOOL))doneCallback
|
|
44
50
|
failCallback:(void (^)(NSError *err))failCallback;
|
|
45
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Patches against baseBundlePath, or against the binary's own bundle when it is nil.
|
|
54
|
+
* The patched bundle always keeps the binary bundle's file name, whatever the base was.
|
|
55
|
+
*/
|
|
56
|
+
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
57
|
+
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
58
|
+
assetHash:(NSString * _Nullable)assetHash
|
|
59
|
+
nativeAssetHash:(NSString * _Nullable)nativeAssetHash
|
|
60
|
+
currentPackage:(NSDictionary * _Nullable)currentPackage
|
|
61
|
+
baseBundlePath:(NSString * _Nullable)baseBundlePath;
|
|
62
|
+
|
|
63
|
+
/** Patches against the binary's own bundle. Kept so an older SDK links against a newer framework. */
|
|
46
64
|
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
47
65
|
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
48
66
|
assetHash:(NSString * _Nullable)assetHash
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
@interface hpatcher : NSObject
|
|
4
|
+
|
|
5
|
+
// return THPatchResult, 0 is ok
|
|
6
|
+
// cacheMemory:
|
|
7
|
+
// cacheMemory is used for file IO, different cacheMemory only affects patch speed;
|
|
8
|
+
// recommended 256*1024,1024*1024,... if cacheMemory<0 then default 256*1024;
|
|
9
|
+
// NOTE: if diffFile created by $xdelta3(-S,-S lzma),$open-vcdiff, alloc memory+=sourceWindowSize+targetWindowSize;
|
|
10
|
+
// ( sourceWindowSize & targetWindowSize is set when diff, C API getVcDiffInfo() can got values from diffFile. )
|
|
11
|
+
// if diffFile created by $bsdiff4, and patch very slow,
|
|
12
|
+
// then cacheMemory recommended oldFileSize+256*1024;
|
|
13
|
+
|
|
14
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
15
|
+
withDiff:(NSString *)diffFileName
|
|
16
|
+
toNew:(NSString *)outNewFileName;
|
|
17
|
+
|
|
18
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
19
|
+
withDiff:(NSString *)diffFileName
|
|
20
|
+
toNew:(NSString *)outNewFileName
|
|
21
|
+
byMemory:(int64_t)cacheMemory;
|
|
22
|
+
|
|
23
|
+
@end
|
|
Binary file
|
|
Binary file
|
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/DiffUpdates.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
g/pumjyvm0+YW5l1ITg21uE1aks=
|
|
10
|
+
</data>
|
|
11
|
+
<key>Headers/hpatch_objc.h</key>
|
|
12
|
+
<data>
|
|
13
|
+
SaiQblz/yRr77onv7z8Ugu73qD8=
|
|
10
14
|
</data>
|
|
11
15
|
<key>Info.plist</key>
|
|
12
16
|
<data>
|
|
13
|
-
|
|
17
|
+
2zKOg08DVcAALLhU4O6Sww/NWPU=
|
|
14
18
|
</data>
|
|
15
19
|
<key>Modules/module.modulemap</key>
|
|
16
20
|
<data>
|
|
@@ -21,21 +25,20 @@
|
|
|
21
25
|
<dict>
|
|
22
26
|
<key>Headers/DiffUpdates.h</key>
|
|
23
27
|
<dict>
|
|
24
|
-
<key>
|
|
28
|
+
<key>hash2</key>
|
|
25
29
|
<data>
|
|
26
|
-
|
|
30
|
+
wph2g8VsI7OQgHbVrjlwf1Th3yy7DNGvT17//mXP4JY=
|
|
27
31
|
</data>
|
|
32
|
+
</dict>
|
|
33
|
+
<key>Headers/hpatch_objc.h</key>
|
|
34
|
+
<dict>
|
|
28
35
|
<key>hash2</key>
|
|
29
36
|
<data>
|
|
30
|
-
|
|
37
|
+
njsIVvkyjrzbeGuTmt0E8DrCRWuM7HykrRewMTqIatw=
|
|
31
38
|
</data>
|
|
32
39
|
</dict>
|
|
33
40
|
<key>Modules/module.modulemap</key>
|
|
34
41
|
<dict>
|
|
35
|
-
<key>hash</key>
|
|
36
|
-
<data>
|
|
37
|
-
MdjndwGRSccoMYmOwMDjozLG1jc=
|
|
38
|
-
</data>
|
|
39
42
|
<key>hash2</key>
|
|
40
43
|
<data>
|
|
41
44
|
TkYpCqgNFTGwSnC7+iZu51GEITzi1EHKvjZj4HupKms=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revopush/react-native-code-push",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "React Native plugin for the CodePush service",
|
|
5
5
|
"main": "CodePush.js",
|
|
6
6
|
"typings": "typings/react-native-code-push.d.ts",
|
|
@@ -37,18 +37,14 @@
|
|
|
37
37
|
"url": "https://github.com/revopush/react-native-code-push"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@revopush/code-push": "4.
|
|
41
|
-
"
|
|
42
|
-
"hoist-non-react-statics": "^3.3.2",
|
|
43
|
-
"inquirer": "^8.1.5",
|
|
44
|
-
"plist": "^3.0.4",
|
|
45
|
-
"semver": "^7.3.5",
|
|
46
|
-
"xcode": "3.0.1"
|
|
40
|
+
"@revopush/code-push": "4.6.0",
|
|
41
|
+
"hoist-non-react-statics": "^3.3.2"
|
|
47
42
|
},
|
|
48
43
|
"devDependencies": {
|
|
44
|
+
"@react-native/gradle-plugin": "0.79.6",
|
|
49
45
|
"@types/assert": "^1.5.2",
|
|
50
46
|
"@types/mkdirp": "^1.0.1",
|
|
51
|
-
"@types/mocha": "^
|
|
47
|
+
"@types/mocha": "^10.0.0",
|
|
52
48
|
"@types/node": "^14.0.27",
|
|
53
49
|
"@types/q": "^1.5.4",
|
|
54
50
|
"archiver": "latest",
|
|
@@ -57,7 +53,7 @@
|
|
|
57
53
|
"del": "v6.0.0",
|
|
58
54
|
"express": "latest",
|
|
59
55
|
"mkdirp": "latest",
|
|
60
|
-
"mocha": "^
|
|
56
|
+
"mocha": "^11.7.6",
|
|
61
57
|
"q": "^1.5.1",
|
|
62
58
|
"run-sequence": "latest",
|
|
63
59
|
"shx": "^0.3.4",
|
|
@@ -65,6 +61,10 @@
|
|
|
65
61
|
"tslint": "^6.1.3",
|
|
66
62
|
"typescript": "^4.4.3"
|
|
67
63
|
},
|
|
64
|
+
"overrides": {
|
|
65
|
+
"serialize-javascript": "^7.0.3",
|
|
66
|
+
"diff": "^8.0.3"
|
|
67
|
+
},
|
|
68
68
|
"rnpm": {
|
|
69
69
|
"android": {
|
|
70
70
|
"packageInstance": "new CodePush(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)"
|
|
@@ -73,10 +73,6 @@
|
|
|
73
73
|
"sharedLibraries": [
|
|
74
74
|
"libz"
|
|
75
75
|
]
|
|
76
|
-
},
|
|
77
|
-
"commands": {
|
|
78
|
-
"postlink": "node node_modules/@revopush/react-native-code-push/scripts/postlink/run",
|
|
79
|
-
"postunlink": "node node_modules/@revopush/react-native-code-push/scripts/postunlink/run"
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
}
|
package/tsconfig.json
CHANGED
|
@@ -89,6 +89,24 @@ export interface Package {
|
|
|
89
89
|
* The size of the code contained within the update, in bytes.
|
|
90
90
|
*/
|
|
91
91
|
packageSize: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The manifest-scheme hash of this update's JS bundle. Present from server versions that
|
|
95
|
+
* report it; used to match a locally held bundle against a diff's base.
|
|
96
|
+
*/
|
|
97
|
+
bundleHash?: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* URL of this update's bundle-only archive.
|
|
101
|
+
*/
|
|
102
|
+
bundleBlobUrl?: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The base release this update's bundle diff applies to. Absent when the update has no diff.
|
|
106
|
+
*/
|
|
107
|
+
basePackage?: {
|
|
108
|
+
packageHash: string;
|
|
109
|
+
};
|
|
92
110
|
}
|
|
93
111
|
|
|
94
112
|
export interface RemotePackage extends Package {
|
|
Binary file
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
var linkTools = require('../../tools/linkToolsAndroid');
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
var inquirer = require('inquirer');
|
|
4
|
-
|
|
5
|
-
module.exports = () => {
|
|
6
|
-
|
|
7
|
-
console.log("Running android postlink script");
|
|
8
|
-
|
|
9
|
-
var buildGradlePath = linkTools.getBuildGradlePath();
|
|
10
|
-
var mainApplicationPath = linkTools.getMainApplicationLocation();
|
|
11
|
-
|
|
12
|
-
// 1. Add the getJSBundleFile override
|
|
13
|
-
var getJSBundleFileOverride = linkTools.getJSBundleFileOverride;
|
|
14
|
-
|
|
15
|
-
if (mainApplicationPath) {
|
|
16
|
-
var mainApplicationContents = fs.readFileSync(mainApplicationPath, "utf8");
|
|
17
|
-
if (linkTools.isJsBundleOverridden(mainApplicationContents)) {
|
|
18
|
-
console.log(`"getJSBundleFile" is already overridden`);
|
|
19
|
-
} else {
|
|
20
|
-
var reactNativeHostInstantiation = linkTools.reactNativeHostInstantiation;
|
|
21
|
-
mainApplicationContents = mainApplicationContents.replace(reactNativeHostInstantiation,
|
|
22
|
-
`${reactNativeHostInstantiation}${getJSBundleFileOverride}`);
|
|
23
|
-
fs.writeFileSync(mainApplicationPath, mainApplicationContents);
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
var mainActivityPath = linkTools.getMainActivityPath();
|
|
27
|
-
if (mainActivityPath) {
|
|
28
|
-
var mainActivityContents = fs.readFileSync(mainActivityPath, "utf8");
|
|
29
|
-
if (linkTools.isJsBundleOverridden(mainActivityContents)) {
|
|
30
|
-
console.log(`"getJSBundleFile" is already overridden`);
|
|
31
|
-
} else {
|
|
32
|
-
var mainActivityClassDeclaration = linkTools.mainActivityClassDeclaration;
|
|
33
|
-
mainActivityContents = mainActivityContents.replace(mainActivityClassDeclaration,
|
|
34
|
-
`${mainActivityClassDeclaration}${getJSBundleFileOverride}`);
|
|
35
|
-
fs.writeFileSync(mainActivityPath, mainActivityContents);
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
return Promise.reject(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
39
|
-
Please refer to plugin configuration section for Android at \
|
|
40
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-configuration-for-react-native-lower-than-060-android for more details`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!fs.existsSync(buildGradlePath)) {
|
|
45
|
-
return Promise.reject(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
46
|
-
Please refer to plugin installation section for Android at \
|
|
47
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// 2. Add the codepush.gradle build task definitions
|
|
51
|
-
var buildGradleContents = fs.readFileSync(buildGradlePath, "utf8");
|
|
52
|
-
var reactGradleLink = buildGradleContents.match(/\napply from: ["'].*?react\.gradle["']/)[0];
|
|
53
|
-
var codePushGradleLink = linkTools.codePushGradleLink;
|
|
54
|
-
if (~buildGradleContents.indexOf(codePushGradleLink)) {
|
|
55
|
-
console.log(`"codepush.gradle" is already linked in the build definition`);
|
|
56
|
-
} else {
|
|
57
|
-
buildGradleContents = buildGradleContents.replace(reactGradleLink,
|
|
58
|
-
`${reactGradleLink}${codePushGradleLink}`);
|
|
59
|
-
fs.writeFileSync(buildGradlePath, buildGradleContents);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//3. Add deployment key
|
|
63
|
-
var stringsResourcesPath = linkTools.getStringsResourcesPath();
|
|
64
|
-
if (!stringsResourcesPath) {
|
|
65
|
-
return Promise.reject(new Error(`Couldn't find strings.xml. You might need to update it manually.`));
|
|
66
|
-
} else {
|
|
67
|
-
var stringsResourcesContent = fs.readFileSync(stringsResourcesPath, "utf8");
|
|
68
|
-
var deploymentKeyName = linkTools.deploymentKeyName;
|
|
69
|
-
if (~stringsResourcesContent.indexOf(deploymentKeyName)) {
|
|
70
|
-
console.log(`${deploymentKeyName} already specified in the strings.xml`);
|
|
71
|
-
} else {
|
|
72
|
-
return inquirer.prompt({
|
|
73
|
-
"type": "input",
|
|
74
|
-
"name": "androidDeploymentKey",
|
|
75
|
-
"message": "What is your CodePush deployment key for Android (hit <ENTER> to ignore)"
|
|
76
|
-
}).then(function(answer) {
|
|
77
|
-
var insertAfterString = "<resources>";
|
|
78
|
-
var deploymentKeyString = `\t<string moduleConfig="true" name="${deploymentKeyName}">${answer.androidDeploymentKey || "deployment-key-here"}</string>`;
|
|
79
|
-
stringsResourcesContent = stringsResourcesContent.replace(insertAfterString,`${insertAfterString}\n${deploymentKeyString}`);
|
|
80
|
-
fs.writeFileSync(stringsResourcesPath, stringsResourcesContent);
|
|
81
|
-
return Promise.resolve();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return Promise.resolve();
|
|
87
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var linkTools = require('../../tools/linkToolsIos');
|
|
3
|
-
var fs = require("fs");
|
|
4
|
-
var inquirer = require('inquirer');
|
|
5
|
-
var plist = require("plist");
|
|
6
|
-
var semver = require('semver');
|
|
7
|
-
|
|
8
|
-
var package = require('../../../../../package.json');
|
|
9
|
-
|
|
10
|
-
module.exports = () => {
|
|
11
|
-
|
|
12
|
-
console.log("Running ios postlink script");
|
|
13
|
-
|
|
14
|
-
var appDelegatePath = linkTools.getAppDeletePath();
|
|
15
|
-
|
|
16
|
-
if (!appDelegatePath) {
|
|
17
|
-
return Promise.reject(`Couldn't find AppDelegate. You might need to update it manually \
|
|
18
|
-
Please refer to plugin configuration section for iOS at \
|
|
19
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
|
|
23
|
-
|
|
24
|
-
// 1. Add the header import statement
|
|
25
|
-
if (~appDelegateContents.indexOf(linkTools.codePushHeaderImportStatement)) {
|
|
26
|
-
console.log(`"CodePush.h" header already imported.`);
|
|
27
|
-
} else {
|
|
28
|
-
var appDelegateHeaderImportStatement = `#import "AppDelegate.h"`;
|
|
29
|
-
appDelegateContents = appDelegateContents.replace(appDelegateHeaderImportStatement,
|
|
30
|
-
`${appDelegateHeaderImportStatement}${linkTools.codePushHeaderImportStatementFormatted}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// 2. Modify jsCodeLocation value assignment
|
|
34
|
-
var reactNativeVersion = package && package.dependencies && package.dependencies["react-native"];
|
|
35
|
-
|
|
36
|
-
if (!reactNativeVersion) {
|
|
37
|
-
console.log(`Can't take react-native version from package.json`);
|
|
38
|
-
} else if (semver.gte(semver.coerce(reactNativeVersion), "0.59.0")) {
|
|
39
|
-
var oldBundleUrl = linkTools.oldBundleUrl;
|
|
40
|
-
var codePushBundleUrl = linkTools.codePushBundleUrl;
|
|
41
|
-
|
|
42
|
-
if (~appDelegateContents.indexOf(codePushBundleUrl)) {
|
|
43
|
-
console.log(`"BundleUrl" already pointing to "[CodePush bundleURL]".`);
|
|
44
|
-
} else {
|
|
45
|
-
if (~appDelegateContents.indexOf(oldBundleUrl)) {
|
|
46
|
-
appDelegateContents = appDelegateContents.replace(oldBundleUrl, codePushBundleUrl);
|
|
47
|
-
} else {
|
|
48
|
-
console.log(`AppDelegate isn't compatible for linking`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
var jsCodeLocations = appDelegateContents.match(/(jsCodeLocation = .*)/g);
|
|
53
|
-
|
|
54
|
-
if (!jsCodeLocations) {
|
|
55
|
-
console.log('Couldn\'t find jsCodeLocation setting in AppDelegate.');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var newJsCodeLocationAssignmentStatement = linkTools.codePushGradleLink;
|
|
59
|
-
if (~appDelegateContents.indexOf(newJsCodeLocationAssignmentStatement)) {
|
|
60
|
-
console.log(`"jsCodeLocation" already pointing to "[CodePush bundleURL]".`);
|
|
61
|
-
} else {
|
|
62
|
-
if (jsCodeLocations.length === 1) {
|
|
63
|
-
// If there is one `jsCodeLocation` it means that react-native app version is not the 0.57.8 or 0.57.0 and lower than 0.59
|
|
64
|
-
// and we should replace this line with DEBUG ifdef statement and add CodePush call for Release case
|
|
65
|
-
|
|
66
|
-
var oldJsCodeLocationAssignmentStatement = jsCodeLocations[0];
|
|
67
|
-
var jsCodeLocationPatch = linkTools.getJsCodeLocationPatch(oldJsCodeLocationAssignmentStatement);
|
|
68
|
-
appDelegateContents = appDelegateContents.replace(oldJsCodeLocationAssignmentStatement,
|
|
69
|
-
jsCodeLocationPatch);
|
|
70
|
-
} else if (jsCodeLocations.length === 2) {
|
|
71
|
-
// If there are two `jsCodeLocation` it means that react-native app version is higher than 0.57.8 or equal
|
|
72
|
-
// and we should replace the second one(Release case) with CodePush call
|
|
73
|
-
|
|
74
|
-
appDelegateContents = appDelegateContents.replace(jsCodeLocations[1],
|
|
75
|
-
newJsCodeLocationAssignmentStatement);
|
|
76
|
-
} else {
|
|
77
|
-
console.log(`AppDelegate isn't compatible for linking`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
var plistPath = linkTools.getPlistPath();
|
|
83
|
-
|
|
84
|
-
if (!plistPath) {
|
|
85
|
-
return Promise.reject(`Couldn't find .plist file. You might need to update it manually \
|
|
86
|
-
Please refer to plugin configuration section for iOS at \
|
|
87
|
-
https://github.com/microsoft/react-native-code-push#plugin-configuration-ios`);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var plistContents = fs.readFileSync(plistPath, "utf8");
|
|
91
|
-
|
|
92
|
-
// 3. Add CodePushDeploymentKey to plist file
|
|
93
|
-
var parsedInfoPlist = plist.parse(plistContents);
|
|
94
|
-
if (parsedInfoPlist.CodePushDeploymentKey) {
|
|
95
|
-
console.log(`"CodePushDeploymentKey" already specified in the plist file.`);
|
|
96
|
-
writePatches();
|
|
97
|
-
return Promise.resolve();
|
|
98
|
-
} else {
|
|
99
|
-
return inquirer.prompt({
|
|
100
|
-
"type": "input",
|
|
101
|
-
"name": "iosDeploymentKey",
|
|
102
|
-
"message": "What is your CodePush deployment key for iOS (hit <ENTER> to ignore)"
|
|
103
|
-
}).then(function(answer) {
|
|
104
|
-
parsedInfoPlist.CodePushDeploymentKey = answer.iosDeploymentKey || "deployment-key-here";
|
|
105
|
-
plistContents = plist.build(parsedInfoPlist);
|
|
106
|
-
|
|
107
|
-
writePatches();
|
|
108
|
-
return Promise.resolve();
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function writePatches() {
|
|
113
|
-
fs.writeFileSync(appDelegatePath, appDelegateContents);
|
|
114
|
-
fs.writeFileSync(plistPath, plistContents);
|
|
115
|
-
}
|
|
116
|
-
}
|
package/scripts/postlink/run.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
var linkTools = require('../../tools/linkToolsAndroid');
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
|
|
4
|
-
module.exports = () => {
|
|
5
|
-
|
|
6
|
-
console.log("Running android postunlink script");
|
|
7
|
-
|
|
8
|
-
var mainApplicationPath = linkTools.getMainApplicationLocation();
|
|
9
|
-
|
|
10
|
-
// 1. Remove the getJSBundleFile override
|
|
11
|
-
var getJSBundleFileOverride = linkTools.getJSBundleFileOverride;
|
|
12
|
-
|
|
13
|
-
if (mainApplicationPath) {
|
|
14
|
-
var mainApplicationContents = fs.readFileSync(mainApplicationPath, "utf8");
|
|
15
|
-
if (!linkTools.isJsBundleOverridden(mainApplicationContents)) {
|
|
16
|
-
console.log(`"getJSBundleFile" is already removed`);
|
|
17
|
-
} else {
|
|
18
|
-
mainApplicationContents = mainApplicationContents.replace(`${getJSBundleFileOverride}`, "");
|
|
19
|
-
fs.writeFileSync(mainApplicationPath, mainApplicationContents);
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
var mainActivityPath = linkTools.getMainActivityPath();
|
|
23
|
-
if (mainActivityPath) {
|
|
24
|
-
var mainActivityContents = fs.readFileSync(mainActivityPath, "utf8");
|
|
25
|
-
if (!linkTools.isJsBundleOverridden(mainActivityContents)) {
|
|
26
|
-
console.log(`"getJSBundleFile" is already removed`);
|
|
27
|
-
} else {
|
|
28
|
-
mainActivityContents = mainActivityContents.replace(getJSBundleFileOverride, "");
|
|
29
|
-
fs.writeFileSync(mainActivityPath, mainActivityContents);
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
console.log(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
33
|
-
Please refer to plugin configuration section for Android at \
|
|
34
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-configuration-for-react-native-lower-than-060-android for more details`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// 2. Remove the codepush.gradle build task definitions
|
|
39
|
-
var buildGradlePath = linkTools.getBuildGradlePath();
|
|
40
|
-
|
|
41
|
-
if (!fs.existsSync(buildGradlePath)) {
|
|
42
|
-
console.log(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
43
|
-
Please refer to plugin installation section for Android at \
|
|
44
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
45
|
-
} else {
|
|
46
|
-
var buildGradleContents = fs.readFileSync(buildGradlePath, "utf8");
|
|
47
|
-
var codePushGradleLink = linkTools.codePushGradleLink;
|
|
48
|
-
if (!~buildGradleContents.indexOf(codePushGradleLink)) {
|
|
49
|
-
console.log(`"codepush.gradle" is already unlinked in the build definition`);
|
|
50
|
-
} else {
|
|
51
|
-
buildGradleContents = buildGradleContents.replace(`${codePushGradleLink}`,"");
|
|
52
|
-
fs.writeFileSync(buildGradlePath, buildGradleContents);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 3. Remove deployment key
|
|
57
|
-
var stringsResourcesPath = linkTools.getStringsResourcesPath();
|
|
58
|
-
if (!stringsResourcesPath) {
|
|
59
|
-
return Promise.reject(new Error("Couldn't find strings.xml. You might need to update it manually."));
|
|
60
|
-
} else {
|
|
61
|
-
var stringsResourcesContent = fs.readFileSync(stringsResourcesPath, "utf8");
|
|
62
|
-
var deploymentKeyName = linkTools.deploymentKeyName;
|
|
63
|
-
if (!~stringsResourcesContent.indexOf(deploymentKeyName)) {
|
|
64
|
-
console.log(`${deploymentKeyName} already removed from the strings.xml`);
|
|
65
|
-
} else {
|
|
66
|
-
var AndroidDeploymentKey = stringsResourcesContent.match(/(<string moduleConfig="true" name="CodePushDeploymentKey">.*<\/string>)/);
|
|
67
|
-
if (AndroidDeploymentKey) {
|
|
68
|
-
stringsResourcesContent = stringsResourcesContent.replace(`\n\t${AndroidDeploymentKey[0]}`,"");
|
|
69
|
-
fs.writeFileSync(stringsResourcesPath, stringsResourcesContent);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return Promise.resolve();
|
|
74
|
-
}
|