The main purpose of this repository is to ease the process of adding and upgrading the React Native dependencies of Gutenberg, specifically, the part the related to publishing the artifacts of the Android libraries of the dependencies.
For now, this repository only supports dependencies that don’t have a forked repository, so when adding a package note that we can only use versions from the NPM registry (e.g. "react-native-get-random-values": "1.4.0"
).
NOTE: This setup might not work for all dependencies. In the future, it might require further modifications to get new packages published.
- Clone this repository.
- Run command
npm install
to install the dependencies.
If you need to publish the same versions of the artifacts but with a breaking change, such as an updated compileSdkVersion
, then the publisherVersion
in build.gradle.kts
will need to be incremented. Please see the documentation for publisherVersion
in build.gradle.kts
for more details.
- Add the package to the
devDependencies
section of thepackage.json
file.
Example:
"react-native-get-random-values": "1.4.0"
- Add the Android project of the dependency to the
settings.gradle.kts
file.
Example:
include(":react-native-get-random-values")
project(":react-native-get-random-values").projectDir = File(rootProject.projectDir, "node_modules/react-native-get-random-values/android")
- Add the name of the Android project to the
PROJECTS
array of.buildkite/publish-libraries.sh
file. - Run command
npm install
to install the new package. - Push the changes to a branch and create a PR.
- Wait for the
buildkite/react-native-libraries-publisher/publish-to-s3
PR check to succeed.
- Update the version of the package in the
package.json
file. - Run command
npm install
to install the specified version of the package. - Push the changes to a branch and create a PR.
- Wait for the
buildkite/react-native-libraries-publisher/publish-to-s3
PR check to succeed.
If you're introducing a new package:
- Add the package as new dependency into the
package.json
file ofreact-native-editor
in Gutenberg. - Run command
npm install
within the Gutenberg project.
Once the package is added as a dependency, or if it was already included, add a implementation
statement referencing the package into the following files in Gutenberg:
packages/react-native-bridge/android/react-native-bridge/build.gradle
packages/react-native-editor/android/app/build.gradle
Example:
implementation "org.wordpress.react-native-libraries:react-native-get-random-values:${extractPackageVersion(packageJson, 'react-native-get-random-values', 'dependencies')}"
NOTE: The version of the artifact will be extracted from the package.json
file of the package.