{"_id":"@bonnguyenitc/react-native-ota-hot-update","name":"@bonnguyenitc/react-native-ota-hot-update","dist-tags":{"latest":"2.5.0"},"versions":{"2.5.0":{"name":"@bonnguyenitc/react-native-ota-hot-update","version":"2.5.0","description":"Hot update for react native","source":"./src/index.tsx","main":"./lib/commonjs/index.js","module":"./lib/module/index.js","types":"./lib/typescript/module/src/index.d.ts","scripts":{"example":"yarn workspace @bonnguyenitc/react-native-ota-hot-update-example","test":"jest","typecheck":"tsc","lint":"eslint \"**/*.{js,ts,tsx}\"","clean":"del-cli android/build example/android/build example/android/app/build example/ios/build lib","prepare":"bob build","release":"release-it","build-plugin":"tsc --build plugin","deploy:npm":"bash scripts/deploy-npm.sh"},"keywords":["hot-update","ota","code-push","update","react-native-hotupdate","react-native-codepush","ota-hot-update","custom-ota","rn-hotupdate"],"repository":{"type":"git","url":"git+https://github.com/bonnguyenitc/react-native-ota-hot-update.git"},"author":{"name":"vantuan88291","email":"vantuan88291@gmail.com","url":"https://github.com/vantuan88291"},"license":"MIT","bugs":{"url":"https://github.com/bonnguyenitc/react-native-ota-hot-update/issues"},"homepage":"https://github.com/bonnguyenitc/react-native-ota-hot-update#readme","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"dependencies":{"buffer":"^6.0.3"},"devDependencies":{"@commitlint/config-conventional":"^17.0.2","@evilmartians/lefthook":"^1.5.0","@expo/config-plugins":"^9.0.15","@react-native-community/cli":"15.0.1","@react-native/eslint-config":"^0.73.1","@release-it/conventional-changelog":"9.0.4","@types/jest":"^29.5.5","@types/react":"^18.2.44","commitlint":"^17.0.2","conventional-changelog-conventionalcommits":"^8","del-cli":"^5.1.0","eslint":"^8.51.0","eslint-config-prettier":"^9.0.0","eslint-plugin-jest":"^27.6.0","eslint-plugin-prettier":"^5.0.1","expo-module-scripts":"^4.0.2","jest":"^29.7.0","prettier":"^3.0.3","react":"18.3.1","react-native":"0.76.3","react-native-builder-bob":"^0.33.1","react-native-fs":"2.20.0","release-it":"^17.10.0","turbo":"^1.10.7","typescript":"^5.2.2"},"resolutions":{"@types/react":"^18.2.44"},"peerDependencies":{"isomorphic-git":"*","react":"*","react-native":"*","react-native-fs":"*"},"workspaces":["example"],"packageManager":"yarn@3.6.1","jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"release-it":{"git":{"commitMessage":"chore: release ${version}","tagName":"v${version}","requireCleanWorkingDir":false},"npm":{"publish":true},"github":{"release":true},"plugins":{"@release-it/conventional-changelog":{"preset":"conventionalcommits"}}},"eslintConfig":{"root":true,"extends":["@react-native","prettier"],"rules":{"react/react-in-jsx-scope":"off","prettier/prettier":["error",{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false}]}},"eslintIgnore":["node_modules/","lib/","plugin/build/"],"prettier":{"quoteProps":"consistent","singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false},"react-native-builder-bob":{"source":"src","output":"lib","targets":["codegen",["commonjs",{"esm":true}],["module",{"esm":true}],["typescript",{"project":"tsconfig.build.json","esm":true}]]},"codegenConfig":{"name":"RNOtaHotUpdateSpec","type":"all","jsSrcsDir":"src","outputDir":{"ios":"ios/generated","android":"android/generated"},"android":{"javaPackageName":"com.otahotupdate"},"includesGeneratedCode":true},"create-react-native-library":{"type":"module-mixed","languages":"kotlin-objc","version":"0.44.2"},"_id":"@bonnguyenitc/react-native-ota-hot-update@2.5.0","gitHead":"330a56f33c1d946a3c79882815d60e465288ccdb","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-wcAk4BRP0ugqH7c6qO6Ksk4KkLb+BQjzFhYD0u+VtFhY26zJVCfUJYuWx1QsoNkoDuWyRMKaW4+HY3ZMGA4I8Q==","shasum":"d50f84feb511a600878d540157e4a45813d762e8","tarball":"https://registry.npmjs.org/@bonnguyenitc/react-native-ota-hot-update/-/react-native-ota-hot-update-2.5.0.tgz","fileCount":121,"unpackedSize":309378,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAoI+HCtrmYAF+fOfstgflSj4O/lO5LhNeEaPFj4p1nQAiEAvdXRmEcUS+FI0JwEwZZts33VBt53C+vWxN5TKxIoraE="}]},"_npmUser":{"name":"bonnguyenitc","email":"bonnguyenitc@gmail.com"},"directories":{},"maintainers":[{"name":"bonnguyenitc","email":"bonnguyenitc@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-native-ota-hot-update_2.5.0_1776012345373_0.6728067921958663"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-12T16:45:45.233Z","2.5.0":"2026-04-12T16:45:45.524Z","modified":"2026-04-12T16:45:46.188Z"},"maintainers":[{"name":"bonnguyenitc","email":"bonnguyenitc@gmail.com"}],"description":"Hot update for react native","homepage":"https://github.com/bonnguyenitc/react-native-ota-hot-update#readme","keywords":["hot-update","ota","code-push","update","react-native-hotupdate","react-native-codepush","ota-hot-update","custom-ota","rn-hotupdate"],"repository":{"type":"git","url":"git+https://github.com/bonnguyenitc/react-native-ota-hot-update.git"},"author":{"name":"vantuan88291","email":"vantuan88291@gmail.com","url":"https://github.com/vantuan88291"},"bugs":{"url":"https://github.com/bonnguyenitc/react-native-ota-hot-update/issues"},"license":"MIT","readme":"# @bonnguyenitc/react-native-ota-hot-update\n\nPublished on npm under the scope **`@bonnguyenitc`** so it does not collide with the upstream package `react-native-ota-hot-update`.\n\nThis React Native module allows you to manage hot updates (in-app update) with minimal configuration, similar to Code Push. You can control versioning and host the JS bundle yourself. The library handles the installation of updates after the bundle is downloaded from your server or Git repository. With Code Push retiring soon, this library gives you full control over your update process, whether hosting the bundle on your own server or in a Git repository.\n\n### Key features:\n\n- Host the bundle on your own server or in a Git repository.\n- **`updateApp(url)`** — one-call download and install from a bundle URL using `react-native-blob-util` (see [DOC_OTA_SERVER.md](DOC_OTA_SERVER.md#updateapp-one-call-download-and-install)).\n- Rollback function\n- Crash Handling: Handles crash exceptions when an incorrect bundle is updated and will automatically roll back to the previous bundle version.\n- bundle management features\n\n1. **Demo via server**\n\niOS GIF             | Android GIF\n:-------------------------:|:-------------------------:\n<img src=\"./ioshotupdate.gif\" title=\"iOS GIF\" width=\"250\"> | <img src=\"./androidhotupdate.gif\" title=\"Android GIF\" width=\"250\">\n\n2. **Demo via git repository**\n\niOS GIF             | Android GIF\n:-------------------------:|:-------------------------:\n<img src=\"./iosgit.gif\" title=\"iOS GIF\" width=\"250\"> | <img src=\"./androidgithotupdate.gif\" title=\"Android GIF\" width=\"250\">\n\n3. **Demo bundle management**\n\n[<img src=\"https://raw.githubusercontent.com/vantuan88291/react-native-ota-hot-update/e4d4bd928dc096bbb4fc329ce89e80d288e44ff1/ioshotupdate-new.gif\" title=\"iOS Bundle Management Demo\" width=\"300\">](https://raw.githubusercontent.com/vantuan88291/react-native-ota-hot-update/e4d4bd928dc096bbb4fc329ce89e80d288e44ff1/ioshotupdate-new.gif)\n\n[![npm downloads](https://img.shields.io/npm/dw/%40bonnguyenitc%2Freact-native-ota-hot-update)](https://www.npmjs.com/package/@bonnguyenitc/react-native-ota-hot-update)\n[![npm package](https://img.shields.io/npm/v/%40bonnguyenitc%2Freact-native-ota-hot-update?color=red)](https://www.npmjs.com/package/@bonnguyenitc/react-native-ota-hot-update)\n\n\n## New architecture supported\n\nNew architecture backward compatibility supported from version 2, it also supported old architecture, for source code of version 1.x.x please refer to branch `oldArch`, you might need install version 1.x.x if you are using react native < 0.70\n\n### 🚀 Preview Release: Enhanced Bundle Management (v2.4.0-rc.1)\n\nWe're excited to introduce a preview release with enhanced bundle management features! Version **2.4.0-rc.1** includes:\n\n- **Configurable bundle history**: Manage multiple bundle versions (configurable via `maxBundleVersions`)\n- **New APIs**: `getBundleList()`, `deleteBundleById()`, `clearAllBundles()`\n- **Bundle identification**: Descriptive folder names with version and timestamp\n- **Automatic cleanup**: Older bundles are automatically removed when exceeding the limit\n\nThis is an experimental release for testing. Please try it out and share your feedback! All discussions and issues related to this feature can be found in [PR #132](https://github.com/vantuan88291/react-native-ota-hot-update/pull/132).\n- Branch: `task/manage_bundle`\n\nTo install the preview version:\n```bash\nyarn add @bonnguyenitc/react-native-ota-hot-update@2.4.0-rc.1\n```\n\n## Installation\n\nif you don't want to manage the download progress, need to install blob util together:\n\n```bash\nyarn add @bonnguyenitc/react-native-ota-hot-update && yarn add react-native-blob-util\n```\nAuto linking already, need pod install for ios:\n```bash\ncd ios && pod install\n```\n\n### Expo\n\nModify `app.json`:\n\n```angular2html\n\"plugins\": [\n      \"@bonnguyenitc/react-native-ota-hot-update\",\n      ...\n    ]\n```\n\n### IOS\nOpen `AppDelegate.m` and add this:\n\n```bash\n#import \"OtaHotUpdate.h\"\n...\n{\n#if DEBUG\n  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@\"index\"];\n#else\n  return [OtaHotUpdate getBundle]; ## add this line\n#endif\n}\n```\n### IOS React native 0.77 or above\n\nFrom react native 0.77, AppDelegate changed to swift file, so the configuration will be change a bit.\n\nOpen AppDelegate.swift:\n\n```bash\n\nimport react_native_ota_hot_update\n...\n\noverride func bundleURL() -> URL? {\n        #if DEBUG\n            RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: \"index\")\n        #else\n            OtaHotUpdate.getBundle()  // -> Add this line\n        #endif\n}\n```\n\n#### For downloading in background mode on IOS, following this (optional):\n\nAppDelegate.h:\n```bash\n@property (nonatomic, assign) UIBackgroundTaskIdentifier taskIdentifier;\n```\nAppDelegate.mm:\n\n```bash\n- (void)applicationWillResignActive:(UIApplication *)application {\n   if (self.taskIdentifier != UIBackgroundTaskInvalid) {\n      [application endBackgroundTask:self.taskIdentifier];\n      self.taskIdentifier = UIBackgroundTaskInvalid;\n   }\n\n   __weak AppDelegate *weakSelf = self;\n   self.taskIdentifier = [application beginBackgroundTaskWithName:nil expirationHandler:^{\n      if (weakSelf) {\n          [application endBackgroundTask:weakSelf.taskIdentifier];\n          weakSelf.taskIdentifier = UIBackgroundTaskInvalid;\n      }\n   }];\n}\n```\n\nAppDelegate.swift(RN >= 0.77):\n\n```bash\nclass AppDelegate: RCTAppDelegate {\nvar taskIdentifier: UIBackgroundTaskIdentifier = .invalid\n...\n```\n```bash\n  public override func applicationDidEnterBackground(_ application: UIApplication) {\n    if taskIdentifier != .invalid {\n      application.endBackgroundTask(taskIdentifier)\n      taskIdentifier = .invalid\n    }\n\n    taskIdentifier = application.beginBackgroundTask(withName: \"OTAUpdate\") { [weak self] in\n      if let strongSelf = self {\n        application.endBackgroundTask(strongSelf.taskIdentifier)\n        strongSelf.taskIdentifier = .invalid\n      }\n    }\n  }\n\n  public override func applicationWillEnterForeground(_ application: UIApplication) {\n    if taskIdentifier != .invalid {\n      application.endBackgroundTask(taskIdentifier)\n      taskIdentifier = .invalid\n    }\n  }\n```\n\n\n### Android\nOpen `MainApplication.kt` and add these codes bellow:\n```bash\nimport com.otahotupdate.OtaHotUpdate\n...\noverride val reactNativeHost: ReactNativeHost =\n  object : DefaultReactNativeHost(this) {\n    ...\n    override fun getJSBundleFile(): String? {\n      return OtaHotUpdate.bundleJS(this@MainApplication)\n    }\n    ...\n  }\n\n```\n\nMainApplication.java:\n```bash\n\t\t@Nullable\n\t\t@Override\n\t\tprotected String getJSBundleFile() {\n\t\t\treturn OtaHotUpdate.getBundleJS(this);\n\t\t}\n```\n\n### Android in react native 0.82 or above:\n\n```bash\n  override val reactHost: ReactHost by lazy {\n    getDefaultReactHost(\n      context = applicationContext,\n      packageList =\n        PackageList(this).packages.apply {\n          // Packages that cannot be autolinked yet can be added manually here, for example:\n          // add(MyReactNativePackage())\n        },\n      jsBundleFilePath = OtaHotUpdate.bundleJS(applicationContext)\n    )\n  }\n```\n\nFor java it maybe can be like: `OtaHotUpdate.Companion.getBundleJS(this)` depend on kotlin / jdk version on your project, you can use android studio to get the correct format coding.\n\nIf want to remove bundle wrong handler, pass false param in getBundleJS like this:\n\n```aiignore\nreturn OtaHotUpdate.bundleJS(this@MainApplication, false)\n\n```\n\nOpen `AndroidManifest.xml` :\n\n`<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />`\n\n`<application\n...\nandroid:requestLegacyExternalStorage=\"true\"\n`\n\n## That's it, can check the example code\n`Remember hot update just work at release mode, debug mode won't working`\n\n\n### Control Hot Update via Server\nWith this method, you can host the bundle JS on your own server. The app fetches the updates directly from the server, allowing for dynamic updates.\n\nFor detailed instructions on how to implement this, refer to [**DOC_OTA_SERVER.md**](DOC_OTA_SERVER.md). That guide includes **`updateApp`** for the minimal flow (single bundle URL, no manual `DownloadManager` wiring) and **`downloadBundleUri`** for full control.\n\n**Minimal example (after installing `react-native-blob-util`):**\n\n```javascript\nimport hotUpdate from '@bonnguyenitc/react-native-ota-hot-update';\n\nawait hotUpdate.updateApp('https://your.cdn.com/path/to/bundle.zip');\n```\n\n---\n\n### Control Hot Update via Git Repository\nThis method allows you to use a Git repository to host the bundle JS. The app pulls updates directly from the repository, providing an easy and version-controlled way to manage updates.\n\nFor detailed instructions on how to implement this, refer to [**DOC_OTA_GIT.md**](DOC_OTA_GIT.md).\n\n\n### Build a Custom Admin Panel with CMS\nUsing Strapi, you can build a tailored admin panel to manage React Native hot updates effectively. This approach allows you to centralize the control of versioning and OTA updates while providing a user-friendly interface for managing content. To get started, refer to the detailed steps and code examples in this guide. For additional details, see [**OTA_CMS.md**](OTA_CMS.md).\n\n\n## License\n\n[MIT](LICENSE)\n\n\n### Sponsor this project\nhttps://paypal.me/vantuan88291\n","readmeFilename":"README.md","_rev":"1-cbe6d337b209f520e8a81b5b3cb5f03b"}