@codeonair/code-push-cli
v0.10.1
Published
CodePush CLI for React Native: release over-the-air (OTA) JS bundle updates from your terminal or CI, with staged rollouts and rollback. Works with Expo and Hermes.
Maintainers
Readme
@codeonair/code-push-cli
The CodePush CLI for React Native. Release over-the-air (OTA) updates with CodeOnAir CodePush: fix a bug or change copy without waiting for store review, roll out to a percentage of devices, and roll back from your terminal or CI. Works with bare React Native and Expo (prebuild), Hermes or JSC, Android and iOS — a replacement for the App Center CodePush CLI.
Website · CLI docs · CI/CD guide · App SDK: @codeonair/code-push-react-native
Beta. Commands and output may still change. The CLI tells you when a newer version is out.
Install
npm install -g @codeonair/code-push-cli@beta
codeonair-codepush --versionOr run it without installing: npx @codeonair/code-push-cli@beta <command>. Needs Node.js 18 or newer.
Log in
Create an access key in the dashboard (Account → CLI access keys), then:
codeonair-codepush login # opens the page and asks for the key
codeonair-codepush whoamiRelease
Each app has one CodePush deployment per platform, named <app>-android and <app>-ios:
codeonair-codepush app list
codeonair-codepush release-react myapp-android -d "Fix the login button"
codeonair-codepush release-react myapp-ios --mandatoryrelease-react checks your login and the app first, bundles the app (react-native bundle, or expo export:embed
for Expo), compiles it to Hermes bytecode when the app uses Hermes, zips it and uploads it in parts.
| Option | What it does |
| --- | --- |
| -t, --targetBinaryVersion <v> | App versions that get it: 1.2.0, 1.2.x or *. Default: the version in build.gradle / Xcode |
| -m, --mandatory | Installed right away instead of on the next start |
| -d, --description <text> | Release notes |
| -r, --rollout <percent> | Send to a share of devices first, e.g. -r 20 |
| -x, --disabled | Upload without releasing; enable later with patch |
| -e, --entryFile <file> | Entry file (default index.js, or package.json "main") |
| --useHermes true\|false | Override Hermes detection |
| -o, --outputDir <dir> | Keep the bundle in a folder |
Release a folder (native apps' content)
Native Android and iOS apps using the CodeOnAir content SDKs (content-updates-android, CodeOnAirContent) get
images, JSON, strings and web content over the air. Release a folder as it is; its files sit at the root of the zip:
codeonair-codepush release myapp-android ./content 1.2.0 -d "Spring banner"
codeonair-codepush release myapp-ios ./content "1.2.x" --mandatory -r 20The third argument (or -t) is the binary version it's for. -m, -d, -r and -x work as for release-react.
.DS_Store and Thumbs.db are left out.
After a release
codeonair-codepush history myapp-android # releases with installs and failures
codeonair-codepush patch myapp-android -r 100 # widen a rollout
codeonair-codepush patch myapp-android --label v3 -x true # stop a release
codeonair-codepush rollback myapp-android # go back to the previous releaseCI
Set CODEONAIR_ACCESS_KEY (and CODEONAIR_SERVER_URL if you're not on app.codeonair.com) instead of logging in.
Update checks are skipped when CI is set.
Troubleshooting
- "Couldn't read the app's version" — your version comes from a variable; pass
-t 1.2.0. - "hermesc not found" — run
npm installin the app, or pass--useHermes falseif the app doesn't use Hermes. - "CodePush isn't set up for this app" — open the app in the dashboard → CodePush → Set up CodePush.
- Slow or flaky network — parts are retried; raise the per-request timeout with
CODEONAIR_TIMEOUT_MS=300000. - Turn off the update check with
CODEONAIR_NO_UPDATE_CHECK=1.
Help: [email protected]
