### Install Dependencies for Expo Turbopush Example Source: https://turbopush.org/docs/examples/expo Install project dependencies using npm, yarn, or pnpm. ```bash npm install ``` ```bash yarn install ``` ```bash pnpm install ``` -------------------------------- ### Clone the Expo Turbopush Example Repository Source: https://turbopush.org/docs/examples/expo Clone the example repository to get started with Turbopush integration in Expo. ```bash git clone https://github.com/turbopushdev/example-expo-turbopush.git ``` ```bash cd example-expo-turbopush ``` -------------------------------- ### Sync - Install on Resume Source: https://turbopush.org/docs/setup/api-js Configures the update to install on the next resume after a specified duration in the background. ```javascript // Install on resume after 5 min in background codePush.sync({ installMode: codePush.InstallMode.ON_NEXT_RESUME, minimumBackgroundDuration: 300 }); ``` -------------------------------- ### Install Local Package Source: https://turbopush.org/docs/setup/api-js Installs a downloaded update. Can specify install mode and minimum background duration. ```javascript await localPackage.install( installMode?: InstallMode, minimumBackgroundDuration?: number ): Promise; ``` -------------------------------- ### Quick Example Release Source: https://turbopush.org/docs/cli/releasing-updates/react-native A simplified command for a quick release. This example targets an iOS app with the slug 'myapp-ios'. ```bash npx turbopush release-react myapp-ios ios ``` ```bash yarn turbopush release-react myapp-ios ios ``` ```bash pnpm turbopush release-react myapp-ios ios ``` -------------------------------- ### Silent Sync on App Start Source: https://turbopush.org/docs/setup/api-js This example demonstrates the default behavior of silent updates, where updates download silently and apply on the next app restart. No additional configuration is needed beyond wrapping the root component. ```javascript const MyApp = () => ; export default codePush(MyApp); ``` -------------------------------- ### Turbopush CLI Rollback Example (npm) Source: https://turbopush.org/docs/cli/rolling-back-updates Example of rolling back a specific app and deployment using npm. ```bash npx turbopush rollback myapp-ios Production ``` -------------------------------- ### Install Turbopush SDK with pnpm Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Use this command to install the Turbopush SDK and its Expo plugin using pnpm. ```bash pnpm expo install @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties ``` -------------------------------- ### Install Turbopush SDK with npm Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Use this command to install the Turbopush SDK and its Expo plugin using npm. ```bash npx expo install @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties ``` -------------------------------- ### Sync - Mandatory Install Mode Source: https://turbopush.org/docs/setup/api-js Specifies the mandatory install mode, which can be optional on restart but mandatory on resume. ```javascript // Optional on restart, mandatory on resume codePush.sync({ mandatoryInstallMode: codePush.InstallMode.ON_NEXT_RESUME }); ``` -------------------------------- ### Install Turbopush SDK with yarn Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Use this command to install the Turbopush SDK and its Expo plugin using yarn. ```bash yarn expo install @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties ``` -------------------------------- ### Example: Release Expo App with pnpm Source: https://turbopush.org/docs/cli/releasing-updates/expo Example command to release an Expo app update using pnpm with specific values for app slug, platform, and version. ```bash pnpm turbopush release-expo myapp-ios ios "1.0.0" ``` -------------------------------- ### Example: Promote Release with Target Binary Version (pnpm) Source: https://turbopush.org/docs/cli/promoting-updates Promote a specific release to Production from Staging, targeting all compatible binary versions using pnpm. ```bash pnpm turbopush promote myapp-ios Staging Production -t "*" ``` -------------------------------- ### Example: Promote Release with Target Binary Version (npm) Source: https://turbopush.org/docs/cli/promoting-updates Promote a specific release to Production from Staging, targeting all compatible binary versions. ```bash npx turbopush promote myapp-ios Staging Production -t "*" ``` -------------------------------- ### Install Turbopush using npm Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Install the Turbopush package for React Native using npm. ```bash npm install --save @turbopush/react-native-code-push ``` -------------------------------- ### Turbopush CLI Rollback Example (yarn) Source: https://turbopush.org/docs/cli/rolling-back-updates Example of rolling back a specific app and deployment using yarn. ```bash yarn turbopush rollback myapp-ios Production ``` -------------------------------- ### Example: Promote Release with Target Binary Version (yarn) Source: https://turbopush.org/docs/cli/promoting-updates Promote a specific release to Production from Staging, targeting all compatible binary versions using yarn. ```bash yarn turbopush promote myapp-ios Staging Production -t "*" ``` -------------------------------- ### Turbopush CLI Rollback Example (pnpm) Source: https://turbopush.org/docs/cli/rolling-back-updates Example of rolling back a specific app and deployment using pnpm. ```bash pnpm turbopush rollback myapp-ios Production ``` -------------------------------- ### Install Turbopush CLI with npm Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Install the Turbopush CLI as a development dependency in your project using npm. ```bash npm install --save-dev @turbopush/cli ``` -------------------------------- ### Install Turbopush using pnpm Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Install the Turbopush package for React Native using pnpm. ```bash pnpm add @turbopush/react-native-code-push ``` -------------------------------- ### Example: Release Expo App with yarn Source: https://turbopush.org/docs/cli/releasing-updates/expo Example command to release an Expo app update using yarn with specific values for app slug, platform, and version. ```bash yarn turbopush release-expo myapp-ios ios "1.0.0" ``` -------------------------------- ### localPackage.install Source: https://turbopush.org/docs/setup/api-js Installs the downloaded update. The update can be applied immediately or on the next app restart/resume. ```APIDOC ## localPackage.install ### Description Installs the downloaded update. The update can be applied immediately or on the next app restart/resume. ### Method ```javascript await localPackage.install(installMode?: InstallMode, minimumBackgroundDuration?: number): Promise; ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * `installMode` (InstallMode) - Optional - Specifies when the update should be applied. Defaults to `ON_NEXT_RESTART`. * `minimumBackgroundDuration` (number) - Optional - The minimum duration in seconds the app must be in the background for the update to be applied if `installMode` is `ON_NEXT_SUSPEND`. Defaults to 0. ### Request Example ```javascript // Example of installing immediately await localPackage.install(InstallMode.IMMEDIATE); // Example of installing on next restart await localPackage.install(InstallMode.ON_NEXT_RESTART); ``` ### Response #### Success Response (void) This method returns a Promise that resolves when the installation process is complete. #### Response Example ```json // No response body, resolves on success ``` ``` -------------------------------- ### Install Turbopush CLI with pnpm Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Install the Turbopush CLI as a development dependency in your project using pnpm. ```bash pnpm add --dev @turbopush/cli ``` -------------------------------- ### Install Turbopush using yarn Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Install the Turbopush package for React Native using yarn. ```bash yarn add @turbopush/react-native-code-push ``` -------------------------------- ### Install Turbopush CLI with yarn Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Install the Turbopush CLI as a development dependency in your project using yarn. ```bash yarn add --dev @turbopush/cli ``` -------------------------------- ### Silent Sync on Every Resume Source: https://turbopush.org/docs/setup/api-js Configure silent updates to download on app start and install on the next app resume. This ensures users have the latest version without interruption. ```javascript const MyApp = () => ; export default codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })(MyApp); ``` -------------------------------- ### Install Turbopush Packages (npm) Source: https://turbopush.org/docs/setup/expo-setup Install the necessary Turbopush packages using npm. This includes the React Native SDK, the Expo plugin, and expo-build-properties. ```bash npm install --save @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties ``` -------------------------------- ### Install Turbopush Packages (pnpm) Source: https://turbopush.org/docs/setup/expo-setup Install the necessary Turbopush packages using pnpm. This includes the React Native SDK, the Expo plugin, and expo-build-properties. ```bash pnpm add @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties ``` -------------------------------- ### Verify Turbopush CLI installation with npx Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Check if the Turbopush CLI is installed correctly by verifying its version using npx. ```bash npx turbopush --version ``` -------------------------------- ### Install react-native-code-push with pnpm Source: https://turbopush.org/docs Use this command to install the react-native-code-push package using pnpm, recommended for older Turbopush versions or when utilizing CodePushServerURL. ```bash pnpm add react-native-code-push ``` -------------------------------- ### Install react-native-code-push with npm Source: https://turbopush.org/docs Use this command to install the react-native-code-push package using npm, typically for older versions of Turbopush or when using CodePushServerURL. ```bash npm install --save react-native-code-push ``` -------------------------------- ### Install Turbopush Packages (yarn) Source: https://turbopush.org/docs/setup/expo-setup Install the necessary Turbopush packages using yarn. This includes the React Native SDK, the Expo plugin, and expo-build-properties. ```bash yarn add @turbopush/react-native-code-push @turbopush/turbopush-expo-plugin expo-build-properties ``` -------------------------------- ### Install react-native-code-push with yarn Source: https://turbopush.org/docs Use this command to install the react-native-code-push package using yarn, suitable for older Turbopush versions or CodePushServerURL configurations. ```bash yarn add react-native-code-push ``` -------------------------------- ### Get Android Deployment Key (npm) Source: https://turbopush.org/docs/setup/android Use this npm command to list your deployment keys for your Android app. ```bash npx turbopush deployment list -a -k ``` -------------------------------- ### Verify Turbopush CLI installation with yarn Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Check if the Turbopush CLI is installed correctly by verifying its version using yarn. ```bash yarn turbopush --version ``` -------------------------------- ### Verify Turbopush CLI installation with pnpm Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Check if the Turbopush CLI is installed correctly by verifying its version using pnpm. ```bash pnpm turbopush --version ``` -------------------------------- ### Get Android Deployment Key (yarn) Source: https://turbopush.org/docs/setup/android Use this yarn command to list your deployment keys for your Android app. ```bash yarn turbopush deployment list -a -k ``` -------------------------------- ### Get Android Deployment Key (pnpm) Source: https://turbopush.org/docs/setup/android Use this pnpm command to list your deployment keys for your Android app. ```bash pnpm turbopush deployment list -a -k ``` -------------------------------- ### Apply Turbopush CodePush Wrapper Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush The `codePush()` wrapper and its options remain the same when migrating to Turbopush. This example shows the standard integration. ```javascript import codePush from "@turbopush/react-native-code-push"; function App() { // Your app code return ( // Your components ); } // All your existing options still work! export default codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(App); ``` -------------------------------- ### codePush.getUpdateMetadata Source: https://turbopush.org/docs/setup/api-js Retrieves metadata for the currently installed update. ```APIDOC ## codePush.getUpdateMetadata ### Description Retrieves metadata for the currently installed update. ### Method ```javascript codePush.getUpdateMetadata(): Promise; ``` ### Parameters None ### Request Example ```javascript const metadata = await codePush.getUpdateMetadata(); if (metadata) { console.log('Current version:', metadata.label); } ``` ### Response #### Success Response (LocalPackage | null) Returns a `LocalPackage` object with metadata of the installed update, or `null` if no update is installed. #### Response Example ```json { "appVersion": "1.0.0", "deploymentKey": "your-deployment-key", "description": "Initial release", "failedInstall": false, "isFirstRun": false, "isMandatory": false, "isPending": false, "label": "v1.0.0", "packageHash": "abcdef123456", "packageSize": 1024000 } ``` ``` -------------------------------- ### codePush.sync Source: https://turbopush.org/docs/setup/api-js An all-in-one method that checks for, downloads, and installs updates. It supports two modes: silent (default) for background downloads and application on the next restart, and active for prompting the user and immediate application. ```APIDOC ## codePush.sync ### Description All-in-one method: checks, downloads, and installs updates. **Two modes:** 1. **Silent** _(default)_ - Downloads silently, applies on next restart 2. **Active** - Prompts user, applies immediately ### Method `codePush.sync( options?: SyncOptions, syncStatusChangeCallback?: (status: SyncStatus) => void, downloadProgressCallback?: (progress: DownloadProgress) => void, handleBinaryVersionMismatchCallback?: (update: RemotePackage) => void ): Promise;` ### Parameters #### Options Same as `CodePushOptions` except `checkFrequency`. - **deploymentKey** (string) - Optional - Specifies a different deployment key. - **installMode** (InstallMode) - Optional - Determines when the update is installed. Can be `IMMEDIATE`, `ON_NEXT_RESTART`, or `ON_NEXT_RESUME`. - **minimumBackgroundDuration** (number) - Optional - Minimum duration in seconds the app must be in the background before an update is applied (used with `ON_NEXT_RESUME`). - **mandatoryInstallMode** (InstallMode) - Optional - Determines when a mandatory update is installed. - **updateDialog** (object | boolean) - Optional - Controls the update dialog. Can be `true` to show the default dialog, `false` to disable it, or an object with custom properties like `title`, `appendReleaseDescription`, and `descriptionPrefix`. ### Request Example ```javascript // Silent update codePush.sync(); // Active with prompt codePush.sync({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE }); // Different deployment key codePush.sync({ deploymentKey: "KEY" }); // Install on resume after 5 min in background codePush.sync({ installMode: codePush.InstallMode.ON_NEXT_RESUME, minimumBackgroundDuration: 300 }); // Optional on restart, mandatory on resume codePush.sync({ mandatoryInstallMode: codePush.InstallMode.ON_NEXT_RESUME }); // Custom dialog codePush.sync({ updateDialog: { title: "An update is available!", appendReleaseDescription: true, descriptionPrefix: "\n\nChange log:\n" }, installMode: codePush.InstallMode.IMMEDIATE }); // With callbacks codePush.sync( { updateDialog: true }, (status) => { if (status === codePush.SyncStatus.DOWNLOADING_PACKAGE) { showDownloadModal(); } else if (status === codePush.SyncStatus.INSTALLING_UPDATE) { hideDownloadModal(); } }, ({ receivedBytes, totalBytes }) => { updateProgress(receivedBytes / totalBytes); } ); ``` ### Response #### Success Response Returns a `Promise` which resolves to one of the following: - **`UP_TO_DATE` (0)**: App is up-to-date. - **`UPDATE_INSTALLED` (1)**: Update installed, will apply based on `InstallMode`. - **`UPDATE_IGNORED` (2)**: User ignored optional update. - **`SYNC_IN_PROGRESS` (4)**: Another sync is already running. ``` -------------------------------- ### Update iOS CocoaPods Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Navigate to the ios directory and run 'pod install' to integrate the new Turbopush native module. ```bash cd ios && pod install && cd .. ``` -------------------------------- ### Get Installed Update Metadata Source: https://turbopush.org/docs/setup/api-js Retrieves metadata for installed CodePush updates. It can fetch information about the currently running update or any pending updates. Returns null if no relevant updates are found. ```javascript // Get running update info const update = await codePush.getUpdateMetadata(); if (update) { analytics.track({ CodePushRelease: update.label }); } // Check for pending updates const pending = await codePush.getUpdateMetadata(codePush.UpdateState.PENDING); if (pending) { // Maybe force restart? } ``` -------------------------------- ### codePush.sync Source: https://turbopush.org/docs/setup/api-js Synchronizes the application with the update server. This method can be used to check for updates, download, and install them based on the provided options. ```APIDOC ## codePush.sync ### Description Synchronizes the application with the update server. This method can be used to check for updates, download, and install them based on the provided options. ### Method ```javascript codePush.sync(options?: SyncOptions, downloadProgressCallback?: (progress: DownloadProgress) => void, syncStatusChangeCallback?: (status: SyncStatus) => void): Promise; ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * `options` (SyncOptions) - Optional - Configuration options for the sync process, including update check frequency, dialogs, and rollback behavior. * `downloadProgressCallback` (function) - Optional - A callback function that receives download progress updates during the download phase. * `syncStatusChangeCallback` (function) - Optional - A callback function that is invoked whenever the sync status changes. ### Request Example ```javascript const syncOptions = { updateDialog: { optionalInstallButtonLabel: "Install", optionalIgnoreButtonLabel: "Ignore", optionalUpdateMessage: "A new version is available. Do you want to update?", title: "Update Available" }, installMode: InstallMode.ON_NEXT_RESUME, checkFrequency: CheckFrequency.ON_APP_RESUME }; const onSyncStatusChange = (status) => { console.log('Sync status:', SyncStatus[status]); }; const syncResult = await codePush.sync(syncOptions, null, onSyncStatusChange); console.log('Sync finished with status:', SyncStatus[syncResult]); ``` ### Response #### Success Response (SyncStatus) Returns a `SyncStatus` enum value indicating the final status of the synchronization process. #### Response Example ```json // Example: SyncStatus.UP_TO_DATE 2 ``` ``` -------------------------------- ### View Deployment History (npm) Source: https://turbopush.org/docs/cli/release-history Use this command to view the release history of a specific Turbopush deployment. It shows the 50 most recent releases with labels, metadata, and install metrics. ```bash npx turbopush deployment history ``` -------------------------------- ### Configure Public Key for Bundle Verification in Info.plist Source: https://turbopush.org/docs/setup/ios For optional code signing, add the CodePushPublicKey to your Info.plist. This public key is used to verify the signature of downloaded bundles before installation. ```xml CodePushPublicKey -----BEGIN PUBLIC KEY----- MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ== -----END PUBLIC KEY----- ``` -------------------------------- ### Basic CodePush Integration Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Wrap your root App component with the codePush higher-order component for automatic update checks on app start. ```typescript import codePush from "@turbopush/react-native-code-push"; function App() { // Your app code here return ( // Your app components ); } export default codePush(App); ``` -------------------------------- ### CodePush with Interactive Updates Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Configure CodePush to show an update dialog and install updates immediately upon user confirmation. ```typescript import codePush from "@turbopush/react-native-code-push"; function App() { // Your app code return ( // Your app components ); } export default codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(App); ``` -------------------------------- ### List Deployments with Keys (npm) Source: https://turbopush.org/docs/cli/app-management List all deployment channels for a given app. The `-k` flag shows the deployment keys, which are necessary for SDK configuration. ```bash npx turbopush deployment ls -k ``` -------------------------------- ### List Deployments with Keys (pnpm) Source: https://turbopush.org/docs/cli/app-management List all deployment channels for a given app. The `-k` flag shows the deployment keys, which are necessary for SDK configuration. ```bash pnpm turbopush deployment ls -k ``` -------------------------------- ### View Deployment History (pnpm) Source: https://turbopush.org/docs/cli/release-history Use this command with pnpm to view the release history of a specific Turbopush deployment. It shows the 50 most recent releases with labels, metadata, and install metrics. ```bash pnpm turbopush deployment history ``` -------------------------------- ### Release with Parameters (npm) Source: https://turbopush.org/docs/setup/expo-setup Create an iOS release bundle with additional parameters like deployment name, description, mandatory flag, and rollout percentage using npm. ```bash npx turbopush release-expo myapp-ios ios "1.0.0" \ --deploymentName "Production" \ --description "Critical bug fixes" \ --mandatory \ --rollout 50 ``` -------------------------------- ### Basic React Native Release Command Source: https://turbopush.org/docs/cli/releasing-updates/react-native Use this command to initiate a release for a React Native app. Replace `` and `` with your specific values. ```bash npx turbopush release-react ``` ```bash yarn turbopush release-react ``` ```bash pnpm turbopush release-react ``` -------------------------------- ### Create Deployment (npm) Source: https://turbopush.org/docs/cli/app-management Create a new deployment channel within an existing app. Deployments are release channels, with 'Staging' and 'Production' being the defaults. ```bash npx turbopush deployment add ``` -------------------------------- ### Release with Parameters (pnpm) Source: https://turbopush.org/docs/setup/expo-setup Create an iOS release bundle with additional parameters like deployment name, description, mandatory flag, and rollout percentage using pnpm. ```bash pnpm turbopush release-expo myapp-ios ios "1.0.0" \ --deploymentName "Production" \ --description "Critical bug fixes" \ --mandatory \ --rollout 50 ``` -------------------------------- ### Define App Platforms Source: https://turbopush.org/docs/concepts Illustrates how to name apps for different platforms. Each platform requires a separate app. ```text MyApp-iOS ← iOS deployments MyApp-Android ← Android deployments ``` -------------------------------- ### Create Deployment (pnpm) Source: https://turbopush.org/docs/cli/app-management Create a new deployment channel within an existing app. Deployments are release channels, with 'Staging' and 'Production' being the defaults. ```bash pnpm turbopush deployment add ``` -------------------------------- ### List Deployments with Keys (yarn) Source: https://turbopush.org/docs/cli/app-management List all deployment channels for a given app. The `-k` flag shows the deployment keys, which are necessary for SDK configuration. ```bash yarn turbopush deployment ls -k ``` -------------------------------- ### Release with Parameters (yarn) Source: https://turbopush.org/docs/setup/expo-setup Create an iOS release bundle with additional parameters like deployment name, description, mandatory flag, and rollout percentage using yarn. ```bash yarn turbopush release-expo myapp-ios ios "1.0.0" \ --deploymentName "Production" \ --description "Critical bug fixes" \ --mandatory \ --rollout 50 ``` -------------------------------- ### Create Deployment (yarn) Source: https://turbopush.org/docs/cli/app-management Create a new deployment channel within an existing app. Deployments are release channels, with 'Staging' and 'Production' being the defaults. ```bash yarn turbopush deployment add ``` -------------------------------- ### Basic Patching Command Source: https://turbopush.org/docs/cli/patching-updates Use this command to patch metadata for an existing release. Replace `` and `` with your specific values. ```bash npx turbopush patch ``` ```bash yarn turbopush patch ``` ```bash pnpm turbopush patch ``` -------------------------------- ### Promote to Production (npm) Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Promote a previously released update from the Staging deployment to the Production deployment. This command is used after successful testing on Staging. ```bash npx turbopush promote myapp-ios Staging Production ``` -------------------------------- ### codePush.getUpdateMetadata Source: https://turbopush.org/docs/setup/api-js Retrieves metadata for installed CodePush updates. It can fetch information about the currently running update or any pending updates. ```APIDOC ## codePush.getUpdateMetadata ### Description Gets metadata for installed updates matching the specified state. Returns `null` if no relevant updates are found. ### Method ``` codePush.getUpdateMetadata( updateState: UpdateState = UpdateState.RUNNING ): Promise; ``` ### Parameters * `updateState` (UpdateState): The state of the update to retrieve metadata for. Defaults to `UpdateState.RUNNING`. ### Returns * `null` when: * No CodePush updates installed yet * Binary update cleared old CodePush updates * `RUNNING` requested but no CodePush update is running * `PENDING` requested but no pending updates ### Usage Example ```javascript // Get running update info const update = await codePush.getUpdateMetadata(); if (update) { analytics.track({ CodePushRelease: update.label }); } // Check for pending updates const pending = await codePush.getUpdateMetadata(codePush.UpdateState.PENDING); if (pending) { // Maybe force restart? } ``` ``` -------------------------------- ### Sync - With Callbacks Source: https://turbopush.org/docs/setup/api-js Handles update synchronization with callbacks for status changes and download progress. Useful for providing user feedback during the update process. ```javascript codePush.sync( { updateDialog: true }, (status) => { if (status === codePush.SyncStatus.DOWNLOADING_PACKAGE) { showDownloadModal(); } else if (status === codePush.SyncStatus.INSTALLING_UPDATE) { hideDownloadModal(); } }, ({ receivedBytes, totalBytes }) => { updateProgress(receivedBytes / totalBytes); } ); ``` -------------------------------- ### Uninstall App Center CLI with pnpm Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Remove the App Center CLI if it was installed globally using pnpm. ```bash pnpm remove appcenter-cli ``` -------------------------------- ### Uninstall App Center CLI with yarn Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Remove the App Center CLI if it was installed globally using yarn. ```bash yarn remove appcenter-cli ``` -------------------------------- ### Create App (npm) Source: https://turbopush.org/docs/cli/app-management Use this command to register a new app with the Turbopush service. The appSlug identifies your app in CLI commands and deployment keys. ```bash npx turbopush app add --appSlug ``` -------------------------------- ### List All Apps (npm) Source: https://turbopush.org/docs/cli/app-management This command lists all the applications registered under your Turbopush account. ```bash npx turbopush app ls ``` -------------------------------- ### Uninstall App Center CLI with npm Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Remove the App Center CLI if it was installed globally using npm. ```bash npm uninstall appcenter-cli ``` -------------------------------- ### Promote Release Command (npm) Source: https://turbopush.org/docs/cli/promoting-updates Use this command to copy a release from a source deployment to a destination deployment using npm. ```bash npx turbopush promote ``` -------------------------------- ### Create Android Release Bundle (npm) Source: https://turbopush.org/docs/setup/expo-setup Use npm to create an Android release bundle for your app using the turbopush release-expo command. Specify the app name, platform, and version. ```bash npx turbopush release-expo myapp-android android "1.0.0" ``` -------------------------------- ### CodePush with Custom Update Dialog Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Customize the update dialog's text and labels for a tailored user experience. Requires immediate installation mode. ```typescript export default codePush({ updateDialog: { title: "Update Available", optionalUpdateMessage: "A new version is available. Install now?", optionalInstallButtonLabel: "Install", optionalIgnoreButtonLabel: "Later" }, installMode: codePush.InstallMode.IMMEDIATE })(App); ``` -------------------------------- ### Android MainApplication Configuration (RN 0.82+) Source: https://turbopush.org/docs Configure the MainApplication file for React Native 0.82+ to use CodePush. This includes setting up the ReactHost and initializing CodePush with your deployment key. ```kotlin import com.facebook.react.ReactHost import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.microsoft.codepush.react.CodePush class MainApplication : Application(), ReactApplication { override val reactHost: ReactHost by lazy { getDefaultReactHost( context = applicationContext, packageList = PackageList(this).packages.apply { // Packages that cannot be autolinked yet can be added manually here, for example: // add(MyReactNativePackage()) }, jsBundleFilePath = CodePush.getJSBundleFile(), ) } override fun onCreate() { super.onCreate() val deploymentKey = getString(R.string.CodePushDeploymentKey) CodePush.getInstance(deploymentKey, this, BuildConfig.DEBUG) loadReactNative(this) } } ``` -------------------------------- ### codePush.disallowRestart Source: https://turbopush.org/docs/setup/api-js Temporarily blocks restarts for updates with `IMMEDIATE` or `ON_NEXT_RESUME` install modes, as well as direct `restartApp` calls. This is useful for protecting critical user flows. ```APIDOC ## codePush.disallowRestart ### Description Temporarily blocks restarts from: 1. Updates with `InstallMode.IMMEDIATE` 2. Updates with `ON_NEXT_RESUME` when app resumes 3. Direct `restartApp` calls Useful for protecting critical flows like onboarding. ### Method ``` codePush.disallowRestart(): void; ``` ### Usage Example ```javascript const OnboardingProcess = () => { useEffect(() => { // Block restarts during onboarding codePush.disallowRestart(); return () => { // Re-allow on unmount (triggers pending restart if any) codePush.allowRestart(); }; }, []); return ; }; ``` ``` -------------------------------- ### Release with Options (iOS - npm) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release an iOS app update with advanced options using Turbopush and npm. ```bash npx turbopush release-react myapp-ios ios --deploymentName Production --description "First Turbopush release" --mandatory --rollout 50 --targetBinaryVersion "1.0.0" ``` -------------------------------- ### Using Version Ranges for Target Binary Version Source: https://turbopush.org/docs/cli/releasing-updates/react-native The `--targetBinaryVersion` flag supports semantic versioning ranges. This example targets Android versions between 1.2.0 and 2.0.0. ```bash npx turbopush release-react myapp-android android --targetBinaryVersion ">=1.2.0 <2.0.0" ``` ```bash yarn turbopush release-react myapp-android android --targetBinaryVersion ">=1.2.0 <2.0.0" ``` ```bash pnpm turbopush release-react myapp-android android --targetBinaryVersion ">=1.2.0 <2.0.0" ``` -------------------------------- ### View Deployment History (npm) Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Check the deployment history for a specific release on Production. This helps monitor user adoption and track updates. ```bash npx turbopush deployment history myapp-ios Production ``` -------------------------------- ### Create App (pnpm) Source: https://turbopush.org/docs/cli/app-management Use this command to register a new app with the Turbopush service. The appSlug identifies your app in CLI commands and deployment keys. ```bash pnpm turbopush app add --appSlug ``` -------------------------------- ### Release First Update (Android - npm) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release the first update for an Android app using Turbopush with npm. ```bash npx turbopush release-react myapp-android android -t "1.0.0" ``` -------------------------------- ### Create App (yarn) Source: https://turbopush.org/docs/cli/app-management Use this command to register a new app with the Turbopush service. The appSlug identifies your app in CLI commands and deployment keys. ```bash yarn turbopush app add --appSlug ``` -------------------------------- ### View Deployment History (yarn) Source: https://turbopush.org/docs/cli/release-history Use this command with yarn to view the release history of a specific Turbopush deployment. It shows the 50 most recent releases with labels, metadata, and install metrics. ```bash yarn turbopush deployment history ``` -------------------------------- ### Sync - Custom Deployment Key Source: https://turbopush.org/docs/setup/api-js Synchronizes updates using a specific deployment key, allowing for different update channels. ```javascript // Different deployment key codePush.sync({ deploymentKey: "KEY" }); ``` -------------------------------- ### Release with Options (iOS - pnpm) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release an iOS app update with advanced options using Turbopush and pnpm. ```bash pnpm turbopush release-react myapp-ios ios --deploymentName Production --description "First Turbopush release" --mandatory --rollout 50 --targetBinaryVersion "1.0.0" ``` -------------------------------- ### Login to Turbopush CLI (npm) Source: https://turbopush.org/docs/cli/account-management Use this command to log in to your Turbopush account via the CLI using npm. This action will open a browser for authentication. ```bash npx turbopush login ``` -------------------------------- ### Sync - Active Update with Prompt Source: https://turbopush.org/docs/setup/api-js Initiates an active update that prompts the user and applies the update immediately. ```javascript codePush.sync({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE }); ``` -------------------------------- ### Prebuild Native Code (npm) Source: https://turbopush.org/docs/setup/expo-setup Run this command using npm to generate the native code for your Expo app after configuring the Turbopush plugin. ```bash npx expo prebuild ``` -------------------------------- ### Promote to Production (yarn) Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Promote a previously released update from the Staging deployment to the Production deployment. This command is used after successful testing on Staging. ```bash yarn turbopush promote myapp-ios Staging Production ``` -------------------------------- ### Create a New App in Turbopush Source: https://turbopush.org/docs/examples/expo Add a new app to your Turbopush account for Android. Remember to copy the Staging Deployment Key. ```bash npx turbopush app add ``` ```bash yarn turbopush app add ``` ```bash pnpm turbopush app add ``` -------------------------------- ### Promote to Production (pnpm) Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Promote a previously released update from the Staging deployment to the Production deployment. This command is used after successful testing on Staging. ```bash pnpm turbopush promote myapp-ios Staging Production ``` -------------------------------- ### Release First Update (iOS - npm) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release the first update for an iOS app using Turbopush with npm. ```bash npx turbopush release-react myapp-ios ios -t "1.0.0" ``` -------------------------------- ### Release with Options (iOS - yarn) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release an iOS app update with advanced options using Turbopush and yarn. ```bash yarn turbopush release-react myapp-ios ios --deploymentName Production --description "First Turbopush release" --mandatory --rollout 50 --targetBinaryVersion "1.0.0" ``` -------------------------------- ### Promote Release Between Deployments Source: https://turbopush.org/docs/concepts Promote a release from one deployment channel to another, such as from Staging to Production. This ensures the exact same bundle is moved. ```bash turbopush promote myapp-ios Staging Production ``` -------------------------------- ### Promote Release Command (pnpm) Source: https://turbopush.org/docs/cli/promoting-updates Use this command to copy a release from a source deployment to a destination deployment using pnpm. ```bash pnpm turbopush promote ``` -------------------------------- ### Promote Release Command (yarn) Source: https://turbopush.org/docs/cli/promoting-updates Use this command to copy a release from a source deployment to a destination deployment using yarn. ```bash yarn turbopush promote ``` -------------------------------- ### List All Apps (pnpm) Source: https://turbopush.org/docs/cli/app-management This command lists all the applications registered under your Turbopush account. ```bash pnpm turbopush app ls ``` -------------------------------- ### View Deployment History (pnpm) Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Check the deployment history for a specific release on Production. This helps monitor user adoption and track updates. ```bash pnpm turbopush deployment history myapp-ios Production ``` -------------------------------- ### List All Apps (yarn) Source: https://turbopush.org/docs/cli/app-management This command lists all the applications registered under your Turbopush account. ```bash yarn turbopush app ls ``` -------------------------------- ### Log in to Turbopush CLI Source: https://turbopush.org/docs/examples/expo Log in to your Turbopush account using the CLI. This action will open your browser for authentication. ```bash npx turbopush login ``` ```bash yarn turbopush login ``` ```bash pnpm turbopush login ``` -------------------------------- ### Debug Android Emulator or Device with npm Source: https://turbopush.org/docs/cli/debugging Use this command to view Turbopush plugin logs from an Android emulator or device when using npm. ```bash npx turbopush debug android ``` -------------------------------- ### Release to a Percentage of Users Source: https://turbopush.org/docs/concepts Use this command to release updates to a specific percentage of your user base. This allows for phased rollouts and testing in production. ```bash turbopush release-react myapp-ios ios --rollout 10 ``` -------------------------------- ### Debug iOS Simulator with npm Source: https://turbopush.org/docs/cli/debugging Use this command to view Turbopush plugin logs from an iOS simulator when using npm. ```bash npx turbopush debug ios ``` -------------------------------- ### Login to Turbopush CLI with Access Key (npm) Source: https://turbopush.org/docs/cli/account-management Use this command with npm and an access key for CI/CD environments where browser login is not possible. The key persists across logouts. ```bash npx turbopush login --accessKey ``` -------------------------------- ### Turbopush CLI Rollback Syntax (npm) Source: https://turbopush.org/docs/cli/rolling-back-updates Use this command to initiate a rollback for a deployment using npm. ```bash npx turbopush rollback ``` -------------------------------- ### Interactive Update Prompt Source: https://turbopush.org/docs/setup/api-js Implement an interactive update process where the user is prompted before downloading. Mandatory updates will display a notification that cannot be ignored. ```javascript const MyApp = () => ; export default codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(MyApp); ``` -------------------------------- ### Create Android Release Bundle (pnpm) Source: https://turbopush.org/docs/setup/expo-setup Use pnpm to create an Android release bundle for your app using the turbopush release-expo command. Specify the app name, platform, and version. ```bash pnpm turbopush release-expo myapp-android android "1.0.0" ``` -------------------------------- ### Release to Staging (npm) Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Use this command to release an update to the Staging deployment for your iOS app. Ensure your app version matches the release target version. ```bash npx turbopush release-expo myapp-ios ios "1.0.0" -d Staging ``` -------------------------------- ### Release First Update (iOS - pnpm) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release the first update for an iOS app using Turbopush with pnpm. ```bash pnpm turbopush release-react myapp-ios ios -t "1.0.0" ``` -------------------------------- ### Build Android App for Release Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Builds the native Android binary for your Expo app in release mode, preparing it for OTA updates. Use this command once before your first release. ```bash npx expo run:android --variant release ``` ```bash yarn expo run:android --variant release ``` ```bash pnpm expo run:android --variant release ``` -------------------------------- ### Release First Update (Android - pnpm) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release the first update for an Android app using Turbopush with pnpm. ```bash pnpm turbopush release-react myapp-android android -t "1.0.0" ``` -------------------------------- ### Login to Turbopush CLI (yarn) Source: https://turbopush.org/docs/cli/account-management Use this command to log in to your Turbopush account via the CLI using yarn. This action will open a browser for authentication. ```bash yarn turbopush login ``` -------------------------------- ### Build iOS App for Release Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Builds the native iOS binary for your Expo app in release mode, preparing it for OTA updates. Use this command once before your first release. ```bash npx expo run:ios --configuration Release ``` ```bash yarn expo run:ios --configuration Release ``` ```bash pnpm expo run:ios --configuration Release ``` -------------------------------- ### Deployment Keys Table Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush This table displays the deployment keys for Production and Staging environments after creating your apps in Turbopush. ```text ┌────────────┬─────────────────────────────────────┐ │ Name │ Deployment Key │ ├────────────┼─────────────────────────────────────┤ │ Production │ dk_19ffa8fc2a91f2cd9afb3bfecafef06d │ ├────────────┼─────────────────────────────────────┤ │ Staging │ dk_5g5dc7aa6197c1f292cd12ca28f39bb3 │ └────────────┴─────────────────────────────────────┘ ``` -------------------------------- ### Release React Native iOS App with npm and parameters Source: https://turbopush.org/docs Create a release for your React Native iOS app using npm with custom deployment, description, mandatory status, rollout percentage, and target binary version. ```bash npx turbopush release-react myapp-ios ios \ --deploymentName Production \ --description "Critical bug fixes" \ --mandatory \ --rollout 50 \ --targetBinaryVersion "1.0.0" ``` -------------------------------- ### Basic JavaScript Configuration Source: https://turbopush.org/docs/setup/expo-setup Import the codePush HOC and wrap your main App component with it. This enables Turbopush's OTA update functionality for your application. ```javascript import codePush from "@turbopush/react-native-code-push"; const App = () => { // Your app component }; export default App; export default codePush(App); ``` -------------------------------- ### View Deployment History (yarn) Source: https://turbopush.org/docs/blog/ship-expo-updates-in-minutes Check the deployment history for a specific release on Production. This helps monitor user adoption and track updates. ```bash yarn turbopush deployment history myapp-ios Production ``` -------------------------------- ### Create Android Release Bundle (yarn) Source: https://turbopush.org/docs/setup/expo-setup Use yarn to create an Android release bundle for your app using the turbopush release-expo command. Specify the app name, platform, and version. ```bash yarn turbopush release-expo myapp-android android "1.0.0" ``` -------------------------------- ### Release First Update (Android - yarn) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release the first update for an Android app using Turbopush with yarn. ```bash yarn turbopush release-react myapp-android android -t "1.0.0" ``` -------------------------------- ### View Deployment History with Author Info Source: https://turbopush.org/docs/cli/release-history Append the `--displayAuthor` flag to see who released each update in the deployment history. This provides additional context on the origin of each release. ```bash npx turbopush deployment history --displayAuthor ``` -------------------------------- ### Release First Update (iOS - yarn) Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush Release the first update for an iOS app using Turbopush with yarn. ```bash yarn turbopush release-react myapp-ios ios -t "1.0.0" ``` -------------------------------- ### Login to Turbopush CLI (pnpm) Source: https://turbopush.org/docs/cli/account-management Use this command to log in to your Turbopush account via the CLI using pnpm. This action will open a browser for authentication. ```bash pnpm turbopush login ``` -------------------------------- ### Login to Turbopush CLI with Access Key (pnpm) Source: https://turbopush.org/docs/cli/account-management Use this command with pnpm and an access key for CI/CD environments where browser login is not possible. The key persists across logouts. ```bash pnpm turbopush login --accessKey ``` -------------------------------- ### List organizations with npx Source: https://turbopush.org/docs/blog/migrating-from-appcenter-codepush-to-turbopush List all available organizations for your Turbopush account using the CLI with npx. This is useful if you are unsure of your organization's slug. ```bash npx turbopush org list ```