Skip to content

Commit 3626523

Browse files
committed
Add prettier
1 parent 41f3864 commit 3626523

Some content is hidden

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

44 files changed

+1441
-1313
lines changed

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,5 @@ packages/
101101

102102
.watchmanconfig
103103

104+
tslint.json
105+
.prettierrc.json

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"plugins": ["@trivago/prettier-plugin-sort-imports"],
3+
"trailingComma": "all",
4+
"singleQuote": true,
5+
"printWidth": 120,
6+
"importOrderGroupNamespaceSpecifiers": true,
7+
"importOrderSortSpecifiers": true,
8+
"importOrder": ["<THIRD_PARTY_MODULES>", "^[./]"]
9+
}

CONTRIBUTING.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,24 @@ npm install
1515
### Using the plugin manually
1616

1717
Follow these steps to test your modifications to the plugin manually:
18+
1819
- clone this repository
1920
- install the dependencies
2021

21-
Navigate to the root folder from your command line console and run:
22-
```
23-
npm install
24-
```
22+
Navigate to the root folder from your command line console and run:
23+
24+
```
25+
npm install
26+
```
27+
2528
- install the plugin in a React-Native project
2629

27-
Navigate to the root folder of your React-Native project from your command line console and run:
28-
```
29-
npm install local_path_to_your_clone_of_this_repo
30-
```
30+
Navigate to the root folder of your React-Native project from your command line console and run:
31+
32+
```
33+
npm install local_path_to_your_clone_of_this_repo
34+
```
35+
3136
- configure the plugin using the steps in the README.md
3237
- build and run your app on an emulator or device
3338

@@ -43,18 +48,18 @@ Then, make sure you have installed `react-native`.
4348
npm install -g react-native
4449
```
4550

46-
To run Android tests, make sure you have `sdk\tools`, `sdk\emulator` and `sdk\platform-tools` in your PATH.
51+
To run Android tests, make sure you have `sdk\tools`, `sdk\emulator` and `sdk\platform-tools` in your PATH.
4752

4853
To run iOS tests, make sure you've installed CocoaPods and have `.gem/bin` in your PATH.
4954

5055
### Supported platforms
5156

5257
The plugin has end to end tests for Android and iOS. Depending on your development machine OS, you can run some or all the tests.
5358

54-
OS | Supported tests
55-
------------- | -------------
56-
OS X | Android, iOS
57-
Windows | Android
59+
| OS | Supported tests |
60+
| ------- | --------------- |
61+
| OS X | Android, iOS |
62+
| Windows | Android |
5863

5964
### Test descriptions
6065

@@ -81,20 +86,23 @@ If you would like to pull the plugin from NPM rather than running the tests on t
8186
#### Default
8287

8388
To run all of the unit tests on Android and iOS:
89+
8490
```
8591
npm run test
8692
```
8793

8894
#### iOS
8995

9096
To run all of the unit tests on iOS:
97+
9198
```
9299
npm run test:ios
93100
```
94101

95102
#### Android
96103

97104
To run all of the unit tests on Android:
105+
98106
```
99107
npm run test:android
100108
```
@@ -107,26 +115,31 @@ The platforms are ordered as follows, and ran in that order:
107115
android, ios
108116

109117
To run the core unit tests on Android:
118+
110119
```
111120
CORE=true npm run test:android
112121
```
113122

114123
To run all of the unit tests on iOS and pull the plugin from NPM:
124+
115125
```
116126
NPM=true npm run test:ios
117127
```
118128

119129
To run all of the unit tests on Android and iOS without building first:
130+
120131
```
121132
npm run test:fast
122133
```
123134

124135
To run all of the unit tests on iOS and restart the emulators:
136+
125137
```
126138
CLEAN=true npm run test:ios
127139
```
128140

129141
To run the core unit tests on Android and pull the plugin from NPM:
142+
130143
```
131144
NPM=true CORE=true npm run test:android
132145
```

LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ AppZung CodePush Plugin for React Native
22

33
Copyright (c) Louis Lagrange and Louis Lagrange Consulting
44

5-
All rights reserved.
5+
All rights reserved.
66

77
MIT License
88

99
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1010

1111
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1212

13-
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# React Native Module for AppZung CodePush
22

3-
* [AppZung](#appzung)
4-
* [How does it work?](#how-does-it-work)
5-
* [Getting started](#getting-started)
6-
* [iOS Setup](docs/setup-ios.md)
7-
* [Android Setup](docs/setup-android.md)
8-
* [Windows Setup](docs/setup-windows.md)
9-
* [Code signing](docs/code-signing.md)
10-
* [Migrating to AppZung CodePush](#migrating-to-appzung-codepush)
11-
* [Compatibility table](#compatibility-table)
12-
* [Usage](#usage)
13-
* [Advanced usage](./docs/advanced-usage.md)
14-
* [Releasing updates](#releasing-updates)
15-
* [Store guidelines compliance](#store-guidelines-compliance)
16-
* [API Reference](#api-reference)
17-
* [Debugging / Troubleshooting](#debugging--troubleshooting)
3+
- [AppZung](#appzung)
4+
- [How does it work?](#how-does-it-work)
5+
- [Getting started](#getting-started)
6+
- [iOS Setup](docs/setup-ios.md)
7+
- [Android Setup](docs/setup-android.md)
8+
- [Windows Setup](docs/setup-windows.md)
9+
- [Code signing](docs/code-signing.md)
10+
- [Migrating to AppZung CodePush](#migrating-to-appzung-codepush)
11+
- [Compatibility table](#compatibility-table)
12+
- [Usage](#usage)
13+
- [Advanced usage](./docs/advanced-usage.md)
14+
- [Releasing updates](#releasing-updates)
15+
- [Store guidelines compliance](#store-guidelines-compliance)
16+
- [API Reference](#api-reference)
17+
- [Debugging / Troubleshooting](#debugging--troubleshooting)
1818

1919
## AppZung
2020

@@ -43,7 +43,7 @@ The CodePush plugin helps get product improvements in front of your end users in
4343

4444
In order to ensure that your end users always have a functioning version of your app, the CodePush plugin maintains a copy of the previous update, so that in the event that you accidentally push an update which includes a crash, it can automatically roll back. This way, you can rest assured that your newfound release agility won't result in users becoming blocked before you have a chance to roll back on the server. It's a win-win-win!
4545

46-
*Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.mm`/`MainActivity.kt` file, adding a new plugin, or changing an image or video not using `require()` syntax) cannot be distributed via CodePush, and therefore, must be updated via the appropriate store(s).*
46+
_Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.mm`/`MainActivity.kt` file, adding a new plugin, or changing an image or video not using `require()` syntax) cannot be distributed via CodePush, and therefore, must be updated via the appropriate store(s)._
4747

4848
## Getting started
4949

@@ -55,13 +55,13 @@ Otherwise:
5555
npm install --save @appzung/react-native-code-push
5656
```
5757

58-
*NOTE: For Expo apps a plugin will be made available soon. In the meantime, you may eject.*
58+
_NOTE: For Expo apps a plugin will be made available soon. In the meantime, you may eject._
5959

6060
Then continue with installing the native module:
6161

62-
* [iOS Setup](docs/setup-ios.md)
63-
* [Android Setup](docs/setup-android.md)
64-
* [Windows Setup](docs/setup-windows.md)
62+
- [iOS Setup](docs/setup-ios.md)
63+
- [Android Setup](docs/setup-android.md)
64+
- [Windows Setup](docs/setup-windows.md)
6565

6666
## Migrating to AppZung CodePush
6767

@@ -105,7 +105,7 @@ If you are less in a hurry, you can migrate to `@appzung/react-native-code-push`
105105

106106
1. Replace every `react-native-code-push` imports with `@appzung/react-native-code-push` imports
107107
2. (optional) As the package is now compatible with ESM, if you call CodePush functions like `CodePush.sync()` or import types/interfaces, you may have to replace your imports `import CodePush from` to selective imports `import withCodePush, { sync, DownloadProgress } from` (or `import * as CodePush from`)
108-
3. (optional) If you use a jest global mock, move the mock from `__mocks__/react-native-code-push.ts` to `__mocks__/@appzung/react-native-code-push.ts`
108+
3. (optional) If you use a jest global mock, move the mock from `__mocks__/react-native-code-push.ts` to `__mocks__/@appzung/react-native-code-push.ts`
109109
4. (optional) If you use dynamic deployment assignation, rename `deploymentKey` option to `releaseChannelPublicId` (TypeScript should catch that)
110110

111111
#### Change your iOS setup
@@ -127,7 +127,7 @@ If you are less in a hurry, you can migrate to `@appzung/react-native-code-push`
127127
We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the CodePush plugin in order to support the exact version of React Native you are using. The following table outlines which CodePush plugin versions officially support the respective React Native versions:
128128

129129
| React Native version(s) | Android | iOS | Supporting CodePush version(s) |
130-
|-------------------------|-----------------|------|--------------------------------|
130+
| ----------------------- | --------------- | ---- | ------------------------------ |
131131
| <0.59 | - | - | **Unsupported** |
132132
| v0.59 | 4.1+ (TLS 1.2+) | 7 | v5.7.1 |
133133
| v0.60-v0.61 | 4.1+ (TLS 1.2+) | 7 | v6.3.1 |
@@ -152,10 +152,9 @@ With the CodePush plugin downloaded and linked, and your app asking CodePush whe
152152
The simplest way to do this is to "CodePush-ify" your app's root component:
153153

154154
```javascript
155-
import codePush from "@appzung/react-native-code-push";
155+
import codePush from '@appzung/react-native-code-push';
156156

157-
const MyApp = () => {
158-
}
157+
const MyApp = () => {};
159158

160159
export default codePush(MyApp);
161160
```
@@ -171,25 +170,25 @@ codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME })(MyApp);
171170
Alternatively, if you want fine-grained control over when the check happens (like a button press or timer interval), eg. in a staging environment, you can call [`CodePush.sync()`](docs/api-js.md#codepushsync) at any time with your desired `SyncOptions`, and turn off CodePush's automatic checking by specifying a manual `checkFrequency`:
172171

173172
```javascript
174-
import codePush from "@appzung/react-native-code-push";
173+
import codePush from '@appzung/react-native-code-push';
175174

176175
class MyApp extends Component {
177-
onButtonPress() {
178-
codePush.sync({
179-
updateDialog: true,
180-
installMode: codePush.InstallMode.IMMEDIATE
181-
});
182-
}
183-
184-
render() {
185-
return (
186-
<View>
187-
<TouchableOpacity onPress={this.onButtonPress}>
188-
<Text>Check for updates</Text>
189-
</TouchableOpacity>
190-
</View>
191-
)
192-
}
176+
onButtonPress() {
177+
codePush.sync({
178+
updateDialog: true,
179+
installMode: codePush.InstallMode.IMMEDIATE,
180+
});
181+
}
182+
183+
render() {
184+
return (
185+
<View>
186+
<TouchableOpacity onPress={this.onButtonPress}>
187+
<Text>Check for updates</Text>
188+
</TouchableOpacity>
189+
</View>
190+
);
191+
}
193192
}
194193

195194
export default codePush({ checkFrequency: codePush.CheckFrequency.MANUAL })(MyApp);
@@ -203,7 +202,7 @@ Once your app is configured and distributed to your users, and you have made som
203202

204203
### Locally
205204

206-
*NOTE: Before you can start releasing updates, please log into AppZung by running the `appzung auth login` command.*
205+
_NOTE: Before you can start releasing updates, please log into AppZung by running the `appzung auth login` command._
207206

208207
In its most basic form, this command looks like this:
209208

@@ -233,7 +232,7 @@ For more details about how the `appzung releases deploy-react-native` command wo
233232

234233
If you run into any issues, or have any questions/comments/feedback, you can check out the [troubleshooting](#debugging--troubleshooting) details below or email us at [email protected].
235234

236-
*NOTE: CodePush updates should be tested in modes other than Debug mode. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply.*
235+
_NOTE: CodePush updates should be tested in modes other than Debug mode. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply._
237236

238237
### On CI
239238

@@ -257,13 +256,14 @@ Android Google Play and iOS App Store have corresponding guidelines that have ru
257256
### Google play
258257

259258
Third paragraph of [Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/9888379?hl=en) topic describe that updating source code by any method other than Google Play's update mechanism is restricted. But this restriction does not apply to updating javascript bundles.
259+
260260
> This restriction does not apply to code that runs in a virtual machine and has limited access to Android APIs (such as JavaScript in a webview or browser).
261261
262262
That fully allow CodePush as it updates just JS bundles and can't update native code part.
263263

264264
### App Store
265265

266-
Paragraph **3.3.2**, since back in 2015's [Apple Developer Program License Agreement](https://developer.apple.com/programs/ios/information/) fully allowed performing over-the-air updates of JavaScript and assets - and in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
266+
Paragraph **3.3.2**, since back in 2015's [Apple Developer Program License Agreement](https://developer.apple.com/programs/ios/information/) fully allowed performing over-the-air updates of JavaScript and assets - and in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
267267

268268
> Interpreted code may be downloaded to an Application but only so long as such code: (a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store, (b) does not create a store or storefront for other code or applications, and (c) does not bypass signing, sandbox, or other security features of the OS.
269269
@@ -277,9 +277,9 @@ This is not necessarily the case for `updateDialog`, since it won't force the us
277277

278278
## API Reference
279279

280-
* [JavaScript API](docs/api-js.md)
281-
* [Objective-C API Reference (iOS)](docs/api-ios.md)
282-
* [Java API Reference (Android)](docs/api-android.md)
280+
- [JavaScript API](docs/api-js.md)
281+
- [Objective-C API Reference (iOS)](docs/api-ios.md)
282+
- [Java API Reference (Android)](docs/api-android.md)
283283

284284
## Debugging / Troubleshooting
285285

@@ -293,14 +293,14 @@ Note that by default, React Native logs are disabled on iOS in release builds, s
293293

294294
2. Add the following statement to the top of your `application:didFinishLaunchingWithOptions` method:
295295

296-
```objective-c
297-
RCTSetLogThreshold(RCTLogLevelInfo);
298-
```
296+
```objective-c
297+
RCTSetLogThreshold(RCTLogLevelInfo);
298+
```
299299
300300
Now you'll be able to see CodePush logs in either debug or release mode, on both iOS or Android. If examining the logs don't provide an indication of the issue, please refer to the following common issues for additional resolution ideas:
301301
302302
| Issue / Symptom | Possible Solution |
303-
|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
303+
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
304304
| Compilation Error | Double-check that your version of React Native is [compatible](#compatibility-table) with the CodePush version you are using. |
305305
| Network timeout / hang when calling `sync` or `checkForUpdate` in the iOS Simulator | Try resetting the simulator by selecting the `Simulator -> Reset Content and Settings..` menu item, and then re-running your app. |
306306
| Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the release channel public ID you added to your `Info.plist` (iOS), `strings.xml` or `app/build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `appzung release-channels list` to view the correct public ID for your app release channel. |

0 commit comments

Comments
 (0)