Skip to content

Commit 49bd44d

Browse files
committed
docs: add Docusaurus configuration and update package.json for documentation support
1 parent c0633c5 commit 49bd44d

24 files changed

Lines changed: 4018 additions & 246 deletions

.github/workflows/docs.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: oven-sh/setup-bun@v2
26+
with:
27+
bun-version: latest
28+
29+
- name: Install dependencies
30+
working-directory: docs
31+
run: bun install --frozen-lockfile
32+
33+
- name: Build docs
34+
working-directory: docs
35+
run: bun run build
36+
37+
- uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: docs/build
40+
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
steps:
48+
- id: deployment
49+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,7 @@ lib/
6363
.eslintcache
6464
.cache
6565
*.tsbuildinfo
66+
67+
# Docusaurus
68+
docs/.docusaurus/
69+
docs/build/

README.md

Lines changed: 18 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -12,105 +12,42 @@
1212

1313
<br />
1414

15-
## Features
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
5216

5317
```ts
54-
import { VersionCheck, getCountry, getStoreUrl, getLatestVersion, needsUpdate } from 'react-native-nitro-version-check'
18+
import { VersionCheck, needsUpdate, getStoreUrl } from 'react-native-nitro-version-check'
5519

56-
// Sync properties
20+
// Sync — no bridge, no async
5721
VersionCheck.version // "1.2.0"
5822
VersionCheck.buildNumber // "42"
5923
VersionCheck.packageName // "com.example.app"
6024
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"
6625

26+
// Check for updates
6727
if (await needsUpdate()) {
6828
Linking.openURL(await getStoreUrl())
6929
}
70-
71-
// Only prompt for major updates
72-
if (await needsUpdate({ level: 'major' })) {
73-
// 1.x → 2.x
74-
}
7530
```
7631

77-
## API
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
9533

96-
| Export | Returns | Description |
97-
|--------|---------|-------------|
98-
| `getCountry()` | `string` | Device's 2-letter ISO country code |
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+
Install [react-native-nitro-version-check](https://npmjs.org/react-native-nitro-version-check) from npm:
35+
```sh
36+
bun add react-native-nitro-version-check react-native-nitro-modules
37+
cd ios && pod install
38+
```
10239

103-
#### `needsUpdate` options
40+
## Documentation
10441

105-
| Option | Type | Default | Description |
106-
|--------|------|---------|-------------|
107-
| `level` | `"major" \| "minor" \| "patch"` | `"patch"` | Minimum version bump to trigger `true` |
42+
- [**Nitro Version Check** docs 📚](https://alshehriali0.github.io/react-native-nitro-version-check/)
43+
- [**Getting Started** guide](https://alshehriali0.github.io/react-native-nitro-version-check/docs/getting-started)
44+
- [**Installation** guide](https://alshehriali0.github.io/react-native-nitro-version-check/docs/installation)
45+
- [**API Reference**](https://alshehriali0.github.io/react-native-nitro-version-check/docs/api-reference)
46+
- [**Migration Guide** from react-native-version-check](https://alshehriali0.github.io/react-native-nitro-version-check/docs/migration-guide)
10847

109-
### Utilities
48+
## Contributing
11049

111-
| Function | Returns | Description |
112-
|----------|---------|-------------|
113-
| `compareVersions(v1, v2)` | `-1 \| 0 \| 1` | Compare two semver strings |
50+
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.
11451

11552
## License
11653

0 commit comments

Comments
 (0)