@swyng/react-native-code-push 1.0.1 → 1.0.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.md +1 -1
- package/README.md +5 -5
- package/SECURITY.md +1 -1
- package/docs/api-js.md +2 -2
- package/docs/multi-deployment-testing-android.md +1 -1
- package/docs/multi-deployment-testing-ios.md +3 -3
- package/docs/setup-android.md +2 -2
- package/docs/setup-ios.md +3 -3
- package/expo.js +1 -1
- package/package.json +5 -5
- package/request-fetch-adapter.js +1 -1
- package/scripts/generateBundledResourcesHash.js +1 -1
- package/scripts/postlink/android/postlink.js +2 -2
- package/scripts/postlink/ios/postlink.js +2 -2
- package/scripts/postunlink/android/postunlink.js +2 -2
- package/scripts/postunlink/ios/postunlink.js +2 -2
- package/scripts/tools/linkToolsIos.js +2 -2
package/CLAUDE.md
CHANGED
|
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
|
4
4
|
|
|
5
5
|
## Project Overview
|
|
6
6
|
|
|
7
|
-
SwyngPush React Native (`@swyng/react-native-code-push`) 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. The server-side is hosted at
|
|
7
|
+
SwyngPush React Native (`@swyng/react-native-code-push`) 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. The server-side is hosted at swyng.site.
|
|
8
8
|
|
|
9
9
|
## Development Commands
|
|
10
10
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#### [Sign up with SwyngPush](https://
|
|
1
|
+
#### [Sign up with SwyngPush](https://swyng.site) to use CodePush
|
|
2
2
|
|
|
3
3
|
# React Native Module for SwyngPush
|
|
4
4
|
|
|
5
|
-
This plugin provides client-side integration for the [SwyngPush service](https://
|
|
5
|
+
This plugin provides client-side integration for the [SwyngPush service](https://swyng.site), allowing you to easily add over-the-air updates to your React Native app(s).
|
|
6
6
|
|
|
7
7
|
- [How does it work?](#how-does-it-work)
|
|
8
8
|
- [Supported React Native Platforms](#supported-react-native-platforms)
|
|
@@ -71,7 +71,7 @@ _Note: CodePush only works with Video components when using `require` in the sou
|
|
|
71
71
|
|
|
72
72
|
## Getting Started
|
|
73
73
|
|
|
74
|
-
Once you've followed the general-purpose ["getting started"](https://console.
|
|
74
|
+
Once you've followed the general-purpose ["getting started"](https://console.swyng.site/docs) instructions for setting up your SwyngPush account, you can start CodePush-ifying your React Native app by running the following command from within your app's root directory:
|
|
75
75
|
|
|
76
76
|
```shell
|
|
77
77
|
yarn add @swyng/react-native-code-push
|
|
@@ -244,7 +244,7 @@ This is not necessarily the case for `updateDialog`, since it won't force the us
|
|
|
244
244
|
|
|
245
245
|
Once your app is configured and distributed to your users, and you have made some JS or asset changes, it's time to release them. The recommended way to release them is using the `create_bundle` command in the SwyngPush CLI, which will bundle your JavaScript files, asset files, and release the update to the SwyngPush server.
|
|
246
246
|
|
|
247
|
-
*NOTE: Before you can start releasing updates, please log into [SwyngPush](https://
|
|
247
|
+
*NOTE: Before you can start releasing updates, please log into [SwyngPush](https://swyng.site) by running the `npx @swyng/cli login -u <username> -p <password>` command.*
|
|
248
248
|
|
|
249
249
|
In its most basic form, this command only requires some parameters:
|
|
250
250
|
|
|
@@ -258,7 +258,7 @@ The `create_bundle` command enables such a simple workflow because it provides m
|
|
|
258
258
|
|
|
259
259
|
The CodePush client supports differential updates, so even though you are releasing your JS bundle and assets on every update, your end users will only actually download the files they need. The service handles this automatically so that you can focus on creating awesome apps and we can worry about optimizing end user downloads.
|
|
260
260
|
|
|
261
|
-
For more details about how the `create_bundle` command works, as well as the various parameters it exposes, refer to the [CLI docs](https://console.
|
|
261
|
+
For more details about how the `create_bundle` command works, as well as the various parameters it exposes, refer to the [CLI docs](https://console.swyng.site/docs).
|
|
262
262
|
|
|
263
263
|
### Dynamic Deployment Assignment
|
|
264
264
|
|
package/SECURITY.md
CHANGED
|
@@ -6,7 +6,7 @@ If you believe you have found a security vulnerability in this repository, pleas
|
|
|
6
6
|
|
|
7
7
|
**Please do NOT report security vulnerabilities through public GitHub issues.**
|
|
8
8
|
|
|
9
|
-
Instead, please send an email to [security@
|
|
9
|
+
Instead, please send an email to [security@swyng.site](mailto:security@swyng.site).
|
|
10
10
|
|
|
11
11
|
You should receive a response within 48 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
|
|
12
12
|
|
package/docs/api-js.md
CHANGED
|
@@ -10,7 +10,7 @@ The following sections describe the shape and behavior of these APIs in detail:
|
|
|
10
10
|
|
|
11
11
|
### JavaScript API Reference
|
|
12
12
|
|
|
13
|
-
When you require
|
|
13
|
+
When you require `@swyng/react-native-code-push`, the module object provides the following top-level methods in addition to the root-level [component decorator](#codepush):
|
|
14
14
|
|
|
15
15
|
* [allowRestart](#codepushallowrestart): Re-allows programmatic restarts to occur as a result of an update being installed, and optionally, immediately restarts the app if a pending update had attempted to restart the app while restarts were disallowed. This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method.
|
|
16
16
|
|
|
@@ -128,7 +128,7 @@ The `codePush` decorator accepts an "options" object that allows you to customiz
|
|
|
128
128
|
|
|
129
129
|
* __minimumBackgroundDuration__ *(Number)* - Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
|
|
130
130
|
|
|
131
|
-
* __updateDialog__ *(UpdateDialogOptions)* - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/
|
|
131
|
+
* __updateDialog__ *(UpdateDialogOptions)* - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/swyng-it/swyng#app-store).
|
|
132
132
|
|
|
133
133
|
The following list represents the available options and their defaults:
|
|
134
134
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> NOTE
|
|
4
4
|
>
|
|
5
|
-
> Complete demo configured with "multi-deployment testing" feature is [here](https://github.com/
|
|
5
|
+
> Complete demo configured with "multi-deployment testing" feature is [here](https://github.com/swyng-it/swyng/files/1314118/rncp1004.zip).
|
|
6
6
|
|
|
7
7
|
The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/index.html) allows you to define custom config settings for each "build type" (like debug, release). This mechanism allows you to easily configure your debug builds to use your CodePush staging deployment key and your release builds to use your CodePush production deployment key.
|
|
8
8
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
> NOTE
|
|
4
4
|
>
|
|
5
5
|
> Complete demos configured with "multi-deployment testing" feature are [here]:
|
|
6
|
-
> * **without using cocoa pods**: [link](https://github.com/
|
|
7
|
-
> * **using cocoa pods**: [link](https://github.com/
|
|
6
|
+
> * **without using cocoa pods**: [link](https://github.com/swyng-it/swyng/files/1259957/rncp976.copy.zip)
|
|
7
|
+
> * **using cocoa pods**: [link](https://github.com/swyng-it/swyng/files/1172217/rncp893.copy.zip)
|
|
8
8
|
|
|
9
9
|
Xcode allows you to define custom build settings for each "configuration" (like debug, release), which can then be referenced as the value of keys within the `Info.plist` file (like the `CodePushDeploymentKey` setting). This mechanism allows you to easily configure your builds to produce binaries, which are configured to synchronize with different CodePush deployments.
|
|
10
10
|
|
|
@@ -54,6 +54,6 @@ And that's it! Now when you run or build your app, your staging builds will auto
|
|
|
54
54
|
|
|
55
55
|
*NOTE: CocoaPods users may need to run `pod install` before building with their new release configuration.*
|
|
56
56
|
|
|
57
|
-
*Note: If you encounter the error message `ld: library not found for ...`, please consult [this issue](https://github.com/
|
|
57
|
+
*Note: If you encounter the error message `ld: library not found for ...`, please consult [this issue](https://github.com/swyng-it/swyng/issues/426) for a possible solution.*
|
|
58
58
|
|
|
59
59
|
Additionally, if you want to give them seperate names and/or icons, you can modify the `Product Bundle Identifier`, `Product Name` and `Asset Catalog App Icon Set Name` build settings, which will allow your staging builds to be distinguishable from release builds when installed on the same device.
|
package/docs/setup-android.md
CHANGED
|
@@ -96,7 +96,7 @@ In order to effectively make use of the `Staging` and `Production` deployments t
|
|
|
96
96
|
|
|
97
97
|
### Code Signing setup
|
|
98
98
|
|
|
99
|
-
Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/
|
|
99
|
+
Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/swyng-it/swyng/tree/v3.0.1/cli#code-signing). In order to use Public Key for Code Signing you need to do following steps:
|
|
100
100
|
|
|
101
101
|
Add `CodePushPublicKey` string item to `/path_to_your_app/android/app/src/main/res/values/strings.xml`. It may looks like this:
|
|
102
102
|
|
|
@@ -116,6 +116,6 @@ zwIDAQAB
|
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
### Expo Integration
|
|
119
|
-
1. A pure expo react-native is not supported yet. We are planning to look into this after a while. See https://github.com/
|
|
119
|
+
1. A pure expo react-native is not supported yet. We are planning to look into this after a while. See https://github.com/swyng-it/swyng/issues/5
|
|
120
120
|
2. A bare react-native app with expo sdk is supported, but you have to initialize rn app without `ReactNativeHostWrapper` of expo. It seems `ReactNativeHostWrapper` overrides `getJsBundleFile` internally, which prevents `CodePush` from being configured correctly.
|
|
121
121
|
https://github.com/expo/expo/issues/25865
|
package/docs/setup-ios.md
CHANGED
|
@@ -91,7 +91,7 @@ Once you've acquired the CodePush plugin, you need to integrate it into the Xcod
|
|
|
91
91
|
|
|
92
92
|
CodePush plugin makes HTTPS requests to the following domains:
|
|
93
93
|
|
|
94
|
-
- api.
|
|
94
|
+
- api.swyng.site
|
|
95
95
|
|
|
96
96
|
If you want to change the default HTTP security configuration for any of these domains, you have to define the [`NSAppTransportSecurity` (ATS)][ats] configuration inside your __Info.plist__ file:
|
|
97
97
|
|
|
@@ -104,7 +104,7 @@ If you want to change the default HTTP security configuration for any of these d
|
|
|
104
104
|
<dict>
|
|
105
105
|
<key>NSExceptionDomains</key>
|
|
106
106
|
<dict>
|
|
107
|
-
<key>api.
|
|
107
|
+
<key>api.swyng.site</key>
|
|
108
108
|
<dict><!-- read the ATS Apple Docs for available options --></dict>
|
|
109
109
|
</dict>
|
|
110
110
|
</dict>
|
|
@@ -120,7 +120,7 @@ Before doing anything, please [read the docs][ats] first.
|
|
|
120
120
|
|
|
121
121
|
### Code Signing setup
|
|
122
122
|
|
|
123
|
-
Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/
|
|
123
|
+
Starting with CLI version **2.1.0** you can self sign bundles during release and verify its signature before installation of update. For more info about Code Signing please refer to [relevant code-push documentation section](https://github.com/swyng-it/swyng/tree/v3.0.1/cli#code-signing).
|
|
124
124
|
|
|
125
125
|
In order to configure Public Key for bundle verification you need to add record in `Info.plist` with name `CodePushPublicKey` and string value of public key content. Example:
|
|
126
126
|
|
package/expo.js
CHANGED
|
@@ -242,7 +242,7 @@ const withAndroidGradle = (config) => {
|
|
|
242
242
|
let content = modConfig.modResults.contents;
|
|
243
243
|
|
|
244
244
|
// This part adds the codepush.gradle apply line and is correct.
|
|
245
|
-
const codePushApplyLine = 'apply from: "../../node_modules/@
|
|
245
|
+
const codePushApplyLine = 'apply from: "../../node_modules/@swyng/react-native-code-push/android/codepush.gradle"';
|
|
246
246
|
if (!content.includes(codePushApplyLine)) {
|
|
247
247
|
content += `\n${codePushApplyLine}\n`;
|
|
248
248
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swyng/react-native-code-push",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "React Native plugin for SwyngPush over-the-air updates",
|
|
5
5
|
"main": "CodePush.js",
|
|
6
6
|
"typings": "typings/react-native-code-push.d.ts",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://swyng.site",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react-native",
|
|
10
10
|
"code-push",
|
|
11
11
|
"ota-updates",
|
|
12
12
|
"swyngpush"
|
|
13
13
|
],
|
|
14
|
-
"author": "Swyng <support@
|
|
14
|
+
"author": "Swyng <support@swyng.site>",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/
|
|
45
|
+
"url": "https://github.com/swyng-it/swyng"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"code-push": "4.2.3",
|
|
@@ -88,4 +88,4 @@
|
|
|
88
88
|
"postunlink": "node node_modules/@swyng/react-native-code-push/scripts/postunlink/run"
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
}
|
|
91
|
+
}
|
package/request-fetch-adapter.js
CHANGED
|
@@ -37,7 +37,7 @@ module.exports = {
|
|
|
37
37
|
|
|
38
38
|
function getHttpMethodName(verb) {
|
|
39
39
|
// Note: This should stay in sync with the enum definition in
|
|
40
|
-
// https://github.com/
|
|
40
|
+
// https://github.com/swyng-it/swyng/blob/master/sdk/script/acquisition-sdk.ts#L6
|
|
41
41
|
return [
|
|
42
42
|
"GET",
|
|
43
43
|
"HEAD",
|
|
@@ -83,7 +83,7 @@ function addJsBundleAndMetaToManifest() {
|
|
|
83
83
|
// "CodePushHash.json" file name breaks flow type checking.
|
|
84
84
|
// To fix the issue we need to delete "CodePushHash.json" file and
|
|
85
85
|
// use "CodePushHash" file name instead to store the hash value.
|
|
86
|
-
// Relates to https://github.com/
|
|
86
|
+
// Relates to https://github.com/swyng-it/swyng/issues/577
|
|
87
87
|
var oldSavedResourcesManifestPath = assetsDir + "/" + CODE_PUSH_HASH_OLD_FILE_NAME;
|
|
88
88
|
if (fs.existsSync(oldSavedResourcesManifestPath)) {
|
|
89
89
|
fs.unlinkSync(oldSavedResourcesManifestPath);
|
|
@@ -37,14 +37,14 @@ module.exports = () => {
|
|
|
37
37
|
} else {
|
|
38
38
|
return Promise.reject(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
39
39
|
Please refer to plugin configuration section for Android at \
|
|
40
|
-
https://github.com/
|
|
40
|
+
https://github.com/swyng-it/swyng/blob/master/docs/setup-android.md#plugin-configuration-for-react-native-lower-than-060-android for more details`);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (!fs.existsSync(buildGradlePath)) {
|
|
45
45
|
return Promise.reject(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
46
46
|
Please refer to plugin installation section for Android at \
|
|
47
|
-
https://github.com/
|
|
47
|
+
https://github.com/swyng-it/swyng/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// 2. Add the codepush.gradle build task definitions
|
|
@@ -16,7 +16,7 @@ module.exports = () => {
|
|
|
16
16
|
if (!appDelegatePath) {
|
|
17
17
|
return Promise.reject(`Couldn't find AppDelegate. You might need to update it manually \
|
|
18
18
|
Please refer to plugin configuration section for iOS at \
|
|
19
|
-
https://github.com/
|
|
19
|
+
https://github.com/swyng-it/swyng#plugin-configuration-ios`);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
|
|
@@ -84,7 +84,7 @@ module.exports = () => {
|
|
|
84
84
|
if (!plistPath) {
|
|
85
85
|
return Promise.reject(`Couldn't find .plist file. You might need to update it manually \
|
|
86
86
|
Please refer to plugin configuration section for iOS at \
|
|
87
|
-
https://github.com/
|
|
87
|
+
https://github.com/swyng-it/swyng#plugin-configuration-ios`);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
var plistContents = fs.readFileSync(plistPath, "utf8");
|
|
@@ -31,7 +31,7 @@ module.exports = () => {
|
|
|
31
31
|
} else {
|
|
32
32
|
console.log(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
33
33
|
Please refer to plugin configuration section for Android at \
|
|
34
|
-
https://github.com/
|
|
34
|
+
https://github.com/swyng-it/swyng/blob/master/docs/setup-android.md#plugin-configuration-for-react-native-lower-than-060-android for more details`);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@ module.exports = () => {
|
|
|
41
41
|
if (!fs.existsSync(buildGradlePath)) {
|
|
42
42
|
console.log(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
43
43
|
Please refer to plugin installation section for Android at \
|
|
44
|
-
https://github.com/
|
|
44
|
+
https://github.com/swyng-it/swyng/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
45
45
|
} else {
|
|
46
46
|
var buildGradleContents = fs.readFileSync(buildGradlePath, "utf8");
|
|
47
47
|
var codePushGradleLink = linkTools.codePushGradleLink;
|
|
@@ -14,7 +14,7 @@ module.exports = () => {
|
|
|
14
14
|
if (!appDelegatePath) {
|
|
15
15
|
console.log(`Couldn't find AppDelegate. You might need to update it manually \
|
|
16
16
|
Please refer to plugin configuration section for iOS at \
|
|
17
|
-
https://github.com/
|
|
17
|
+
https://github.com/swyng-it/swyng#plugin-configuration-ios`);
|
|
18
18
|
} else {
|
|
19
19
|
var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
|
|
20
20
|
|
|
@@ -68,7 +68,7 @@ module.exports = () => {
|
|
|
68
68
|
if (!plistPath) {
|
|
69
69
|
return Promise.reject(`Couldn't find .plist file. You might need to update it manually \
|
|
70
70
|
Please refer to plugin configuration section for iOS at \
|
|
71
|
-
https://github.com/
|
|
71
|
+
https://github.com/swyng-it/swyng#plugin-configuration-ios`);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
var plistContents = fs.readFileSync(plistPath, "utf8");
|
|
@@ -22,7 +22,7 @@ exports.getJsCodeLocationPatch = function(defaultJsCodeLocationAssignmentStateme
|
|
|
22
22
|
#endif`;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// Fix for https://github.com/
|
|
25
|
+
// Fix for https://github.com/swyng-it/swyng/issues/477
|
|
26
26
|
// Typical location of AppDelegate.m for newer RN versions: $PROJECT_ROOT/ios/<project_name>/AppDelegate.m
|
|
27
27
|
// Let's try to find that path by filtering the whole array for any path containing <project_name>
|
|
28
28
|
// If we can't find it there, play dumb and pray it is the first path we find.
|
|
@@ -71,7 +71,7 @@ exports.getPlistPath = function() {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
//also remove surrounding quotes from plistPathValue to get correct path resolved
|
|
74
|
-
//(see https://github.com/
|
|
74
|
+
//(see https://github.com/swyng-it/swyng/issues/534#issuecomment-302069326 for details)
|
|
75
75
|
return path.resolve(path.dirname(xcodeProjectPath), '..', plistPathValue.replace(/^"(.*)"$/, '$1'));
|
|
76
76
|
}
|
|
77
77
|
|