Migrating from Community CLI
Automatic Migration
You can automate all the migration steps below by running the following command in your existing React Native project. The CLI will detect your project and guide you through the migration process interactively, automatically updating all necessary files and configurations.
Manual Migration
If you prefer to do it manually or encounter any issues, follow the steps below.
-
Install dev dependencies:
-
Remove
@react-native-community/cliand related packages. -
Add
.rock/folder with caches to.gitignore:.gitignore -
Add
rock.config.mjsfile:rock.config.mjsMove any
projectconfig fromreact-native.config.jsto platform arguments inrock.config.mjs, for example:react-native.config.jstranslates to:
rock.config.mjs -
Update Android files:
In
android/app/build.gradleset thecliFilewith the new path:android/app/build.gradleIn
android/settings.gradlechange:android/settings.gradle -
Update iOS files:
In
ios/Podfilechange:ios/PodfileIn "Bundle React Native code and images" Build Phase in Xcode add:
Bundle -
Cleanup native files:
-
Update scripts in
package.json:package.json -
Run new commands:
Additionally rename flags:
--modeto--variantfor Android commands--modeto--configurationfor iOS commands--buildFolderto--build-folderfor iOS commands--appIdto--app-idfor Android commands--appIdSuffixto--app-id-suffixfor Android commands
And remove unsupported flags:
--interactive/-i– the CLI will prompt you for input where necessary--list-devices- when no devices are connected, you'll be prompt with a full device selection
-
Configure GitHub Actions for remote builds in your workflow
iOS:
.github/workflows/build-iosAndroid:
.github/workflows/build-androidFor more setup options see GitHub Actions configuration
