react-native-nitro-version-check 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/README.md +17 -82
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<b>A
|
|
6
|
+
<b>A lightweight, fast version-checking library for React Native, powered by <a href="https://github.com/mrousavy/nitro">Nitro Modules</a>.</b>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
@@ -12,105 +12,40 @@
|
|
|
12
12
|
|
|
13
13
|
<br />
|
|
14
14
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
- ⥠**Synchronous access** to version, build number, package name, and country
|
|
18
|
-
- ðŠ **Store version lookup** from the App Store or Play Store
|
|
19
|
-
- ð **Granular update checks** â major, minor, or patch
|
|
20
|
-
- ðĶ **Install source detection** â TestFlight, App Store, Play Store, or sideloaded
|
|
21
|
-
- ðŠķ **Tiny footprint** â pure Swift on iOS, Kotlin on Android
|
|
22
|
-
|
|
23
|
-
## Performance
|
|
24
|
-
|
|
25
|
-
Benchmarked against [`react-native-version-check`](https://github.com/kimxogus/react-native-version-check). 100,000 iterations averaged over 5 runs on an iPhone 12:
|
|
26
|
-
|
|
27
|
-
| Method | Speedup |
|
|
28
|
-
|--------|---------|
|
|
29
|
-
| `getAllInfo` | **~3.1x faster** |
|
|
30
|
-
| `packageName` | **~1.6x faster** |
|
|
31
|
-
| `version` | **~1.6x faster** |
|
|
32
|
-
| `buildNumber` | **~1.6x faster** |
|
|
33
|
-
| `getCountry` | **~3.1x faster** |
|
|
34
|
-
|
|
35
|
-
## Installation
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
bun add react-native-nitro-version-check react-native-nitro-modules
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
For Expo projects, run prebuild:
|
|
42
|
-
```sh
|
|
43
|
-
npx expo prebuild
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
For bare React Native projects:
|
|
47
|
-
```sh
|
|
48
|
-
cd ios && pod install
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Usage
|
|
15
|
+
## Example
|
|
52
16
|
|
|
53
17
|
```ts
|
|
54
|
-
import { VersionCheck,
|
|
18
|
+
import { VersionCheck, needsUpdate, getStoreUrl } from 'react-native-nitro-version-check'
|
|
55
19
|
|
|
56
|
-
// Sync
|
|
20
|
+
// Sync â no bridge, no async
|
|
57
21
|
VersionCheck.version // "1.2.0"
|
|
58
22
|
VersionCheck.buildNumber // "42"
|
|
59
23
|
VersionCheck.packageName // "com.example.app"
|
|
60
24
|
VersionCheck.installSource // "appstore" | "testflight" | "playstore" | undefined
|
|
61
|
-
getCountry() // "US"
|
|
62
|
-
|
|
63
|
-
// Async
|
|
64
|
-
const url = await getStoreUrl() // App Store / Play Store URL
|
|
65
|
-
const latest = await getLatestVersion() // "1.3.0"
|
|
66
25
|
|
|
26
|
+
// Check for updates
|
|
67
27
|
if (await needsUpdate()) {
|
|
68
28
|
Linking.openURL(await getStoreUrl())
|
|
69
29
|
}
|
|
70
|
-
|
|
71
|
-
// Only prompt for major updates
|
|
72
|
-
if (await needsUpdate({ level: 'major' })) {
|
|
73
|
-
// 1.x â 2.x
|
|
74
|
-
}
|
|
75
30
|
```
|
|
76
31
|
|
|
77
|
-
##
|
|
78
|
-
|
|
79
|
-
### `VersionCheck`
|
|
80
|
-
|
|
81
|
-
| Property | Type | Description |
|
|
82
|
-
|----------|------|-------------|
|
|
83
|
-
| `version` | `string` | App version |
|
|
84
|
-
| `buildNumber` | `string` | Build number |
|
|
85
|
-
| `packageName` | `string` | Bundle ID / Application ID |
|
|
86
|
-
| `installSource` | `string \| undefined` | `"appstore"` `"testflight"` `"playstore"` or `undefined` |
|
|
87
|
-
| `getCountry()` | `string` | Device's 2-letter ISO country code |
|
|
88
|
-
| `getStoreUrl()` | `Promise<string>` | App Store / Play Store URL |
|
|
89
|
-
| `getLatestVersion()` | `Promise<string>` | Latest version in the store |
|
|
90
|
-
| `needsUpdate()` | `Promise<boolean>` | Whether an update is available |
|
|
91
|
-
|
|
92
|
-
### Standalone exports
|
|
93
|
-
|
|
94
|
-
Also available as individual named exports:
|
|
32
|
+
## Installation
|
|
95
33
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
| `getStoreUrl()` | `Promise<string>` | App Store / Play Store URL |
|
|
100
|
-
| `getLatestVersion()` | `Promise<string>` | Latest version in the store |
|
|
101
|
-
| `needsUpdate(options?)` | `Promise<boolean>` | Whether an update is available |
|
|
34
|
+
```sh
|
|
35
|
+
bun add react-native-nitro-version-check
|
|
36
|
+
```
|
|
102
37
|
|
|
103
|
-
|
|
38
|
+
## Documentation
|
|
104
39
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
40
|
+
- [**Nitro Version Check** docs ð](https://alshehriali0.github.io/react-native-nitro-version-check/)
|
|
41
|
+
- [**Getting Started** guide](https://alshehriali0.github.io/react-native-nitro-version-check/docs/getting-started)
|
|
42
|
+
- [**Installation** guide](https://alshehriali0.github.io/react-native-nitro-version-check/docs/installation)
|
|
43
|
+
- [**API Reference**](https://alshehriali0.github.io/react-native-nitro-version-check/docs/api-reference)
|
|
44
|
+
- [**Migration Guide** from react-native-version-check](https://alshehriali0.github.io/react-native-nitro-version-check/docs/migration-guide)
|
|
108
45
|
|
|
109
|
-
|
|
46
|
+
## Contributing
|
|
110
47
|
|
|
111
|
-
|
|
112
|
-
|----------|---------|-------------|
|
|
113
|
-
| `compareVersions(v1, v2)` | `-1 \| 0 \| 1` | Compare two semver strings |
|
|
48
|
+
See the [contributing guide](https://alshehriali0.github.io/react-native-nitro-version-check/docs/contributing) to learn how to contribute to the repository and the development workflow.
|
|
114
49
|
|
|
115
50
|
## License
|
|
116
51
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-version-check",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "A lightweight, fast version-checking library for React Native, powered by Nitro Modules",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -62,7 +62,8 @@
|
|
|
62
62
|
"nitro-modules-version",
|
|
63
63
|
"app store version",
|
|
64
64
|
"play store version",
|
|
65
|
-
"market version"
|
|
65
|
+
"market version",
|
|
66
|
+
"lightweight"
|
|
66
67
|
],
|
|
67
68
|
"repository": {
|
|
68
69
|
"type": "git",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"bugs": {
|
|
74
75
|
"url": "https://github.com/AlshehriAli0/react-native-nitro-version-check/issues"
|
|
75
76
|
},
|
|
76
|
-
"homepage": "https://github.
|
|
77
|
+
"homepage": "https://alshehriali0.github.io/react-native-nitro-version-check/",
|
|
77
78
|
"publishConfig": {
|
|
78
79
|
"registry": "https://registry.npmjs.org/"
|
|
79
80
|
},
|