Bundle Generation
Before you can deploy OTA updates, you need to generate JavaScript bundles and assets. This guide covers build-time bundling (recommended) and manual methods, with Hermes support.
1. Build-time Bundling (Recommended)
This method integrates DOTA into your build process so bundles are created automatically.
- Android
- iOS
Add to android/app/build.gradle:
apply from: "../../node_modules/@d11/dota/android/codepush.gradle"
During builds, this Gradle script copies the generated bundle and assets to .dota/android.
Optional: disable automatic copying by setting in gradle.properties:
dotaCopyBundle=false
In your Podfile:
# Import at the top
require_relative '../node_modules/@d11/dota/ios/scripts/dota_pod_helpers.rb'
# Include in the post_install block
post_install do |installer|
dota_post_install(installer, 'YourAppTarget', File.expand_path(__dir__))
end
Then run:
cd ios && pod install
During builds, this post_install hook copies the generated bundle and assets to .dota/ios.
Optional: disable automatic copying (in .xcode.env or the shell):
export DOTA_COPY_BUNDLE=false
2. Manual Bundle Generation
Use this method if you need more control over the bundle generation process or need to generate bundles outside of the build process.
- Yarn
- npm / npx
# Android
yarn dota bundle --platform android
# iOS
yarn dota bundle --platform ios
# Android
npx dota bundle --platform android
# iOS
npx dota bundle --platform ios
CLI Options
Customize with available flags:
Options:
--platform <platform> Specify platform: android or ios (required)
--bundle-path <path> Directory to place the bundle in, default is .dota/<platform> (default: ".dota")
--assets-path <path> Directory to place assets in, default is .dota/<platform> (default: ".dota")
--sourcemap-path <path> Directory to place sourcemaps in, default is .dota/<platform> (default: ".dota")
--make-sourcemap Generate sourcemap (default: false)
--entry-file <file> Entry file (default: "index.ts")
--dev <boolean> Development mode (default: "false")
--base-bundle-path <path> Path to base bundle for Hermes bytecode optimization
-h, --help Display help for command
Example with Options
This will generate bundle in ./custom-path/android/index.android.bundle and assets in ./.dota/android/assets/
yarn dota bundle --platform android --bundle-path ./custom-path
Example with Sourcemap
This will generate bundle and sourcemap in ./.dota/android/
yarn dota bundle --platform android --make-sourcemap
For even smaller patch bundles, enable Base Bytecode Optimization (v1.2.0+).