Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"extends": ["@react-native", "prettier"],
"extends": ["prettier"],
"plugins": ["prettier"],
"ignorePatterns": ["node_modules/", "lib/"]
}
59 changes: 56 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ jobs:
- name: Typecheck files
run: yarn typecheck

tester-android:
name: Integrated tester Android App
- name: Test Brownfield CLI
run: |
yarn workspace @callstack/react-native-brownfield brownfield --version

android:
name: 'Android: integrated tester & integration workflow with CLI'
runs-on: ubuntu-latest
needs: build-lint

Expand Down Expand Up @@ -81,10 +85,39 @@ jobs:
restore-keys: |
${{ runner.os }}-tester-integrated-android-gradle-

# == IntegratedTester ==

- name: Generate Brownie stores
run: yarn run brownie:codegen

- name: Build integrated Android tester app
run: yarn run build:tester-integrated:android

tester-ios:
# == RNApp ==

- name: Package AAR with the Brownfield CLI
run: |
cd apps/RNApp
yarn run brownie:package:android

- name: Publish AAR artifact to Maven Local
run: |
cd apps/RNApp
yarn run brownie:publish:android

- name: Verify debug AAR exists in Maven Local
run: stat ~/.m2/repository/com/rnapp/brownfieldlib/0.0.1-local/brownfieldlib-0.0.1-local-debug.aar

- name: Verify release AAR exists in Maven Local
run: stat ~/.m2/repository/com/rnapp/brownfieldlib/0.0.1-local/brownfieldlib-0.0.1-local-release.aar

# == AndroidApp ==

- name: Build native Android Brownfield app
run: |
yarn run build:example:android-consumer

ios:
name: Integrated tester iOS App
runs-on: macos-latest
needs: build-lint
Expand Down Expand Up @@ -130,6 +163,26 @@ jobs:
cd apps/TesterIntegrated/swift
pod install

# == IntegratedTester ==

- name: Build integrated iOS tester app
run: |
yarn run build:tester-integrated:ios

# == RNApp ==

- name: Install pods (RNApp)
run: |
cd apps/RNApp/ios
pod install

- name: Package iOS framework with the Brownfield CLI
run: |
cd apps/RNApp
yarn run brownie:package:ios

# == AppleApp ==

- name: Build Brownfield iOS native app
run: |
yarn run build:example:ios-consumer
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ lib/

# Gradle
secring.gpg

# Typescript
**/*.tsbuildinfo
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
lib
dist
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@ Depending on your needs, you may need to install CocoaPods in a subset of the be
- example React Native iOS app: `cd apps/RNApp/ios && pod install`
- integrated iOS tester app: `cd apps/TesterIntegrated/swift && pod install`

## Contributing changes

After contributing your changes, please make sure to add a [changeset](https://github.com/changesets/changesets) describing your changes. This will help us in publishing new versions.

## Publishing to npm

We use [changesets](https://github.com/changesets/changesets) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc.

## Scripts

- `lint` - runs linting on all JS/TS source files in the monorepo *[Turbo]*
- `gradle-plugin:lint` - runs linting on the Brownfield Gradle plugin source code
- `typecheck` - runs TypeScript type checking on all TS source files in the monorepo *[Turbo]*
- `build` - runs all `build*` tasks in the Turbo repo - see below for more details *[Turbo]*
- `build:watch` - runs all `build:watch` tasks in all workspaces
- `release` - releases a new version of React Native Brownfield package using `release-it`
- `brownfield:plugin:publish:local` - publishes the Brownfield Gradle plugin to your local Maven repository for testing purposes
- `build:brownfield` - builds the React Native Brownfield package (`packages/react-native-brownfield`) *[Turbo]*
Expand Down
5 changes: 5 additions & 0 deletions apps/RNApp/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": ["@react-native", "prettier"],
"plugins": ["prettier"],
"ignorePatterns": ["node_modules/", "lib/"]
}
10 changes: 5 additions & 5 deletions apps/RNApp/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2438,7 +2438,7 @@ PODS:
- React-perflogger (= 0.82.1)
- React-utils (= 0.82.1)
- SocketRocket
- RNScreens (4.18.0):
- RNScreens (4.19.0):
- boost
- DoubleConversion
- fast_float
Expand All @@ -2465,10 +2465,10 @@ PODS:
- ReactCodegen
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNScreens/common (= 4.18.0)
- RNScreens/common (= 4.19.0)
- SocketRocket
- Yoga
- RNScreens/common (4.18.0):
- RNScreens/common (4.19.0):
- boost
- DoubleConversion
- fast_float
Expand Down Expand Up @@ -2814,10 +2814,10 @@ SPEC CHECKSUMS:
ReactBrownfield: 1609c411abb926b1fd3c8557ef67d4138fb56a02
ReactCodegen: 0bce2d209e2e802589f4c5ff76d21618200e74cb
ReactCommon: 801eff8cb9c940c04d3a89ce399c343ee3eff654
RNScreens: 98771ad898d1c0528fc8139606bbacf5a2e9d237
RNScreens: d6413aeb1878cdafd3c721e2c5218faf5d5d3b13
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 46ff53afcbeda2bae19c85b65e17487c3e3984dd

PODFILE CHECKSUM: df18b5948daeaea0547157dc0e289b1adc4ed10c
PODFILE CHECKSUM: 7c116a16dd0744063c8c6293dbfc638c9d447c19

COCOAPODS: 1.15.2
4 changes: 4 additions & 0 deletions apps/RNApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"ios": "react-native run-ios",
"build:example:android-rn": "react-native build-android",
"build:example:ios-rn": "react-native build-ios",
"brownie:package:android": "brownie package:android --module-name :BrownfieldLib --variant release",
"brownie:publish:android": "brownie publish:android --module-name :BrownfieldLib",
"brownie:package:ios": "brownie package:ios --scheme BrownfieldLib --configuration Release",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
Expand All @@ -25,6 +28,7 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@callstack/brownie-cli": "workspace:^",
"@react-native-community/cli": "20.0.0",
"@react-native-community/cli-platform-android": "20.0.0",
"@react-native-community/cli-platform-ios": "20.0.0",
Expand Down
3 changes: 2 additions & 1 deletion apps/TesterIntegrated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"start": "react-native start",
"build:tester-integrated:android": "cd kotlin && ./gradlew assembleDebug",
"build:tester-integrated:ios": "cd swift && xcodebuild -workspace SwiftExample.xcworkspace -scheme SwiftExample -configuration Release -sdk iphonesimulator build CODE_SIGNING_ALLOWED=NO -derivedDataPath ./build",
"codegen": "brownie codegen"
"brownie:codegen": "brownie codegen"
},
"dependencies": {
"@callstack/brownie": "*",
Expand All @@ -22,6 +22,7 @@
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@callstack/brownie-cli": "workspace:^",
"@react-native-community/cli": "20.0.0",
"@react-native-community/cli-platform-android": "20.0.0",
"@react-native-community/cli-platform-ios": "20.0.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/TesterIntegrated/swift/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,7 @@ SPEC CHECKSUMS:
ReactCommon: 804dc80944fa90b86800b43c871742ec005ca424
RNScreens: ffbb0296608eb3560de641a711bbdb663ed1f6b4
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 689c8e04277f3ad631e60fe2a08e41d411daf8eb
Yoga: 8e01cef9947ca77f0477a098f0b32848a8e448c6

PODFILE CHECKSUM: cc9179225629f8397761aa16248efe751042af40

Expand Down
5 changes: 5 additions & 0 deletions docs/docs/docs/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"name": "getting-started",
"label": "Getting Started"
},
{
"type": "dir",
"name": "cli",
"label": "CLI"
},
{
"type": "dir",
"name": "api-reference",
Expand Down
1 change: 1 addition & 0 deletions docs/docs/docs/cli/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["introduction", "brownfield", "brownie"]
66 changes: 66 additions & 0 deletions docs/docs/docs/cli/brownfield.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Usage with Brownfield package

The `brownie` CLI provides utilities for building & packaging artifacts for brownfield projects that use the `@callstack/react-native-brownfield` library.

## Usage

```bash
brownie package:android --module-name :BrownfieldLib --variant release # Package AAR with BrownfieldLib module in release variant
brownie publish:android --module-name :BrownfieldLib # Publish all build variants of BrownfieldLib module to Maven local
brownie package:ios --scheme BrownfieldLib --configuration Release # Package XCFramework for BrownfieldLib scheme in Release configuration
brownie codegen --help # Show help
brownie --version # Show version
```

## iOS

### Build for iOS

Simply run `npx brownie package:ios` to create an XCFramework that you can later integrate into your native iOS app according to other instruction sections below.

Available arguments:

| Argument | Description |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| --verbose | Enable verbose logging |
| --configuration | Explicitly set the scheme configuration to use. This option is case sensitive. |
| --scheme | Explicitly set Xcode scheme to use |
| --target | Explicitly set Xcode target to use |
| --extra-params | Custom params that will be passed to xcodebuild command |
| --export-extra-params | Custom params that will be passed to xcodebuild export archive command. Example: `--export-extra-params "-allowProvisioningUpdates"` |
| --export-options-plist | Name of the export options file for archiving. Defaults to: `ExportOptions.plist` |
| --build-folder | Location for iOS build artifacts. Corresponds to Xcode's "-derivedDataPath". By default, the '\<iOS project folder>/build' path will be used. |
| --destination | Define destination(s) for the build. You can pass multiple destinations as separate values or repeated use of the flag. Values: "simulator", "device", or xcodebuild destinations |
| --archive | Create an Xcode archive (IPA) of the build, required for uploading to App Store Connect or distributing to TestFlight |
| --no-install-pods | Skip automatic CocoaPods installation |
| --no-new-arch | Run React Native in legacy async architecture |
| --local | Force local build with xcodebuild |
| --verbose | Enable verbose logging |

## Android

For Android, building happens in two steps: first, you build (`brownie package:android`) the AAR artifact(s) with your module, in the appropriate build variant(s), and then you `brownie publish:android` them to Maven local.
From there, native applications can consume your library from the local Maven repository.

### Build for Android

To build the artifact for Android without publishing, run `npx brownie package:android --module-name app`.

Available arguments:

| Argument | Description |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| --variant | Specify your app's build variant, which is constructed from build type and product flavor, e.g. 'debug' or 'freeRelease'. (default: "debug") |
| --module-name | AAR module name |
| --verbose | Enable verbose logging |

### Publish locally for Android

To publish the `.aar`(s) built beforehand with `npx brownie publish:android` to Maven local, which will allow Gradle to be able to load it from Maven local repository, run:

`npx brownie publish:android --module-name app`

| Argument | Description |
| ------------- | ---------------------- |
| --module-name | AAR module name |
| --verbose | Enable verbose logging |
Loading
Loading