@appspacer/expo
v1.0.0
Published
AppSpacer OTA asset updates and crash reporting for Expo managed workflow
Maintainers
Readme
@appspacer/expo
Over-The-Air (OTA) asset updates and crash reporting for the Expo managed workflow.
The Expo SDK delivers assets (JSON, images, content files) — not JavaScript code. It downloads the bundle you publish from AppSpacer, verifies its checksum, caches it, and exposes the contents in-app via readAssetJson / readAssetString / readAssetBytes. It also includes a lightweight crash reporter with breadcrumbs.
Push releases with the AppSpacer CLI.
Full documentation: docs.appspacer.com
Installation
npx expo install @appspacer/expoInstall the required Expo peer modules if your project doesn't already have them:
npx expo install expo-application expo-crypto expo-device expo-file-system expo-networkRequirements: Expo SDK 50+, React Native 0.73+.
Quick Start
Initialize the SDK once at app startup:
import { AppSpacer } from '@appspacer/expo';
await AppSpacer.init({
apiKey: 'your-deployment-key',
// appVersion is auto-detected from the native build if omitted
});
// Read content delivered over the air (key matches the published asset).
const config = await AppSpacer.readAssetJson('bundle.zip');By default (updateStrategy: 'onInit') the SDK checks for and downloads updates during init().
Publishing an update
Publish an asset file with the CLI:
# Android — publish a remote config file
appspacer release-expo -p android -a my-app -d Production -f ./remote-config.json
# iOS — mandatory content update with explicit version
appspacer release-expo -p ios -a my-app -d Production -f ./content.json -t 1.2.0 --mandatoryConfiguration
interface AppSpacerConfig {
apiKey: string; // Deployment key from your dashboard
appVersion?: string; // Defaults to the native app version
serverUrl?: string; // Self-hosted API base URL. Default: https://api.appspacer.com/api
debugLogging?: boolean; // Default: false
updateStrategy?: 'onInit' | 'background' | 'manual'; // When to check for updates. Default: 'onInit'
maxBreadcrumbs?: number; // Default: 50
crashReportingEnabled?: boolean; // Default: true
}updateStrategy:
onInit— check andawaitthe update duringinit().background— check duringinit()without blocking startup.manual— never check automatically; callAppSpacer.checkForUpdates()yourself.
API
Updates
| Method | Description |
|--------|-------------|
| AppSpacer.init({ apiKey, config? }) | Initialize the SDK. Call once before anything else. |
| AppSpacer.checkForUpdates() | Manually check for, download, and apply asset updates. Returns an OtaUpdateResult. |
| AppSpacer.readAssetJson(key) | Read a downloaded asset as parsed JSON, or null. |
| AppSpacer.readAssetString(key) | Read a downloaded asset as a string, or null. |
| AppSpacer.readAssetBytes(key) | Read a downloaded asset as Uint8Array, or null. |
| AppSpacer.activeBundleInfo() | Metadata about the currently active bundle. |
| AppSpacer.cacheSize() | Total size of cached assets in bytes. |
| AppSpacer.clearAssetCache() | Remove all cached assets. |
| AppSpacer.reset() | Tear down the SDK instance. |
Crash reporting
| Method | Description |
|--------|-------------|
| AppSpacer.reportError(error, opts?) | Manually report an error with optional stackTrace, context, and extra. |
| AppSpacer.addBreadcrumb(message, category?, data?, level?) | Record a breadcrumb leading up to a crash. |
| AppSpacer.clearBreadcrumbs() | Clear recorded breadcrumbs. |
| AppSpacer.sessionId | Current session id. |
| AppSpacer.pendingCrashCount | Number of crashes queued for delivery. |
Links
- Dashboard: appspacer.com
- CLI: @appspacer/cli
- Documentation: docs.appspacer.com
- Support: appspacer.com/support
License
MIT
