Skip to content

Commit 6d46086

Browse files
committed
feat: initial react-native-update skill package
0 parents  commit 6d46086

File tree

5 files changed

+159
-0
lines changed

5 files changed

+159
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# react-native-update-skill
2+
3+
OpenClaw skill for integrating **react-native-update (Pushy)** into React Native / Expo projects.
4+
5+
## Contents
6+
- `skill/react-native-update/` - skill source (SKILL.md, references, scripts)
7+
- `react-native-update.skill` - packaged distributable skill
8+
9+
## Install
10+
Import `react-native-update.skill` into your OpenClaw skills environment.
11+
12+
## Scope
13+
- Step-by-step integration guidance
14+
- AppKey/update.json wiring
15+
- iOS/Android/Expo integration checkpoints
16+
- Common conflict checks (e.g. expo-updates)

react-native-update.skill

3.09 KB
Binary file not shown.

skill/react-native-update/SKILL.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: react-native-update
3+
description: React Native Update / Pushy hot-update integration assistant(react-native-update 集成助手)for React Native CLI and Expo projects. Use for 安装配置, appKey/update.json 接线, iOS/Android 原生改动, 更新策略(checkStrategy/updateStrategy), expo-updates 冲突排查, and 热更新接入 troubleshooting.
4+
---
5+
6+
# React Native Update Integration
7+
8+
## Overview
9+
Use this skill to get a project from “not integrated” to “hot update works in release builds”.
10+
Prioritize copy-paste-safe steps, smallest viable changes, and explicit verification checkpoints.
11+
12+
## Workflow
13+
1. Detect app type (React Native CLI vs Expo) and target platforms.
14+
2. Apply dependency/install steps from `references/integration-playbook.md`.
15+
3. Apply required native config (Bundle URL / MainApplication integration points).
16+
4. Add `Pushy` client + `UpdateProvider` minimal bootstrapping.
17+
5. Run `scripts/integration_doctor.sh <app-root>` to detect common misses.
18+
6. Return a short action list: done / missing / next verification.
19+
20+
## Guardrails
21+
- Keep user code changes minimal and localized.
22+
- Do not promise hot update works in debug mode; emphasize release verification.
23+
- Warn about `expo-updates` conflict in Expo projects.
24+
- Preserve existing app architecture; adapt snippets to current project style.
25+
- If native files differ heavily (monorepo/mixed native), provide targeted patch guidance instead of broad rewrites.
26+
27+
## Outputs to provide
28+
- Minimal integration diff (exact files and snippets).
29+
- Verification checklist (build, check update, download, switch version).
30+
- Troubleshooting hints for common failures.
31+
32+
## Resources
33+
- Read `references/integration-playbook.md` before giving steps.
34+
- Use `scripts/integration_doctor.sh` for quick project diagnosis.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# react-native-update integration playbook
2+
3+
## 1) Fast path
4+
1. Install CLI and SDK in app root:
5+
- `npm i -g react-native-update-cli`
6+
- `npm i react-native-update`
7+
2. iOS pod install:
8+
- `cd ios && pod install`
9+
3. Generate/select app config (`update.json`) with pushy CLI.
10+
4. Wire appKey from `update.json` by platform.
11+
5. Initialize `Pushy` and wrap app with `UpdateProvider`.
12+
6. Build release package and validate update flow.
13+
14+
## 2) App type specifics
15+
16+
### React Native CLI
17+
- Standard install + iOS pods.
18+
- For very old RN or non-standard project structure, manual link may still be needed.
19+
20+
### Expo
21+
- Require modern Expo workflow; run prebuild when needed:
22+
- `npx expo prebuild`
23+
- Do not co-install `expo-updates` (conflict risk for update behavior).
24+
25+
## 3) Minimum JS wiring
26+
- Read appKey from `update.json` with `Platform.OS`.
27+
- Create `new Pushy({ appKey, ...options })`.
28+
- Wrap app root with `<UpdateProvider client={pushyClient}>`.
29+
30+
## 4) Strategy defaults to discuss
31+
- `checkStrategy`: `both` / `onAppStart` / `onAppResume` / `null`
32+
- `updateStrategy`: `alwaysAlert` / `alertUpdateAndIgnoreError` / `silentAndNow` / `silentAndLater` / `null`
33+
- For custom UI: set `updateStrategy: null`, then use `useUpdate()`.
34+
35+
## 5) Native touchpoints (high level)
36+
37+
### iOS
38+
- Ensure release bundle URL resolves via Pushy bundle method in app delegate flow.
39+
- Keep DEBUG bundle behavior unchanged.
40+
41+
### Android
42+
- Ensure integration point in `MainApplication` (or custom React instance manager path).
43+
44+
## 6) Verification checklist
45+
- [ ] Release build succeeds on target platform.
46+
- [ ] App can call check update and returns structured update state.
47+
- [ ] Update package download succeeds.
48+
- [ ] App can switch to new version (now/later behavior as expected).
49+
- [ ] Rollback behavior understood/tested for crash scenarios.
50+
51+
## 7) Common pitfalls
52+
- Missing/incorrect `update.json` appKey by platform.
53+
- Expecting real apply-update behavior in DEBUG builds.
54+
- Expo project still carrying `expo-updates`.
55+
- iOS pods not installed after dependency update.
56+
- Native file edits not followed by full rebuild.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
APP_ROOT="${1:-$(pwd)}"
5+
cd "$APP_ROOT"
6+
7+
echo "[doctor] app root: $APP_ROOT"
8+
9+
ok(){ echo "[ok] $*"; }
10+
warn(){ echo "[warn] $*"; }
11+
miss(){ echo "[missing] $*"; }
12+
13+
if [ -f package.json ]; then
14+
ok "package.json found"
15+
else
16+
miss "package.json not found"
17+
exit 2
18+
fi
19+
20+
if node -e "const p=require('./package.json'); process.exit((p.dependencies&&p.dependencies['react-native-update'])||(p.devDependencies&&p.devDependencies['react-native-update'])?0:1)"; then
21+
ok "react-native-update dependency present"
22+
else
23+
miss "react-native-update dependency missing"
24+
fi
25+
26+
if [ -f update.json ]; then
27+
ok "update.json found"
28+
if node -e "const u=require('./update.json'); const good=(u.ios&&u.ios.appKey)||(u.android&&u.android.appKey); process.exit(good?0:1)"; then
29+
ok "update.json includes platform appKey"
30+
else
31+
warn "update.json exists but appKey looks incomplete"
32+
fi
33+
else
34+
miss "update.json missing (run pushy createApp/selectApp)"
35+
fi
36+
37+
if [ -d ios ]; then
38+
if [ -f ios/Podfile ]; then
39+
ok "ios/Podfile found"
40+
else
41+
warn "ios exists but Podfile missing"
42+
fi
43+
fi
44+
45+
if [ -d android ]; then
46+
ok "android project found"
47+
fi
48+
49+
if grep -R --line-number --include='package.json' 'expo-updates' . >/dev/null 2>&1; then
50+
warn "expo-updates detected; may conflict depending on integration mode"
51+
fi
52+
53+
echo "[doctor] done"

0 commit comments

Comments
 (0)