Skip to content

Commit 5b86b2b

Browse files
feat: brownfield unified CLI (#176)
* chore: squashed rework of repo * ci: consolidate per-platform jobs to reduce cache entry count * feat: brownfield CLI * chore: add missing dependencies * chore: add build:watch script * feat: android CLI * feat: iOS CLI * ci: update CI to use the new iOS CLI * chore: update Podfile for RNApp * chore: move CLI files to new package * chore: config files for new packages * chore: react-native-brownfield package to depend on the CLI * chore: update CONTRIBUTING.md * fix: problems with imports and scripts * docs: add CLI docs * ci: adjust paths to CLI * fix: iOS build error from brownie PR * fix: linting * feat: unified CLI * ci: use brownie CLI in CI * feat: adjust to new Rock API * docs: add CLI documentation * fix: make Rock iOS packaging logic work in non-Rock projects * chore: depend on production rock packages * fix: brownie CLI iOS - pass packageDir to Rock helpers and use .brownie folder as output base * chore: bump up Rock to 0.12.5 * chore: rename build:watch scripts to dev * WIP * feat: migrate to vitest * refactor: changes after CR * fix: problems after migration to vitest * refactor: rename brownie CLI to brownfield to resolve ambiguity * refactor: changes after CR * fix(docs): typo & dead link * feat: new package name for brownfield CLI * fix: retrieve proper RN version for iOS build * docs: improve CLI docs * chore: add verbose logging to RNApp package scripts * chore: target iOS 15.6 in RNApp to match CI environment * chore: depend on CLI package in brownie * fix(ci): typo in step name * fix(ci): workaround for ENOSPC and leftover character in iOS command * docs: updated docs * feat: rename CLI output directory to .brownfield * fix(demo): use new path to iOS artifacts --------- Co-authored-by: Oskar Kwaśniewski <oskarkwasniewski@icloud.com>
1 parent a021352 commit 5b86b2b

72 files changed

Lines changed: 2558 additions & 489 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"root": true,
3-
"extends": ["@react-native", "prettier"],
3+
"extends": ["prettier"],
44
"plugins": ["prettier"],
55
"ignorePatterns": ["node_modules/", "lib/"]
66
}

.github/workflows/ci.yml

Lines changed: 69 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ jobs:
3030
- name: Typecheck files
3131
run: yarn typecheck
3232

33-
tester-android:
34-
name: Integrated tester Android App
33+
- name: Test Brownfield CLI
34+
run: |
35+
yarn workspace @callstack/react-native-brownfield brownfield --version
36+
37+
android:
38+
name: 'Android: integrated tester & integration workflow with CLI'
3539
runs-on: ubuntu-latest
3640
needs: build-lint
3741

@@ -48,6 +52,18 @@ jobs:
4852
distribution: 'zulu'
4953
java-version: '17'
5054

55+
- name: Free Disk Space (Ubuntu)
56+
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
57+
with:
58+
tool-cache: false
59+
60+
android: false
61+
dotnet: true
62+
haskell: true
63+
large-packages: true
64+
docker-images: true
65+
swap-storage: true
66+
5167
- name: Setup Node.js
5268
uses: actions/setup-node@65d868f8d4d85d7d4abb7de0875cde3fcc8798f5 # v6
5369
with:
@@ -71,7 +87,7 @@ jobs:
7187
restore-keys: |
7288
${{ runner.os }}-tester-android-build-
7389
74-
- name: Resture Gradle cache
90+
- name: Restore Gradle cache
7591
uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5
7692
with:
7793
path: |
@@ -81,10 +97,39 @@ jobs:
8197
restore-keys: |
8298
${{ runner.os }}-tester-integrated-android-gradle-
8399
100+
# == IntegratedTester ==
101+
102+
- name: Generate Brownie stores
103+
run: yarn run brownfield:codegen
104+
84105
- name: Build integrated Android tester app
85106
run: yarn run build:tester-integrated:android
86107

87-
tester-ios:
108+
# == RNApp ==
109+
110+
- name: Package AAR with the Brownfield CLI
111+
run: |
112+
cd apps/RNApp
113+
yarn run brownfield:package:android
114+
115+
- name: Publish AAR artifact to Maven Local
116+
run: |
117+
cd apps/RNApp
118+
yarn run brownfield:publish:android
119+
120+
- name: Verify debug AAR exists in Maven Local
121+
run: stat ~/.m2/repository/com/rnapp/brownfieldlib/0.0.1-local/brownfieldlib-0.0.1-local-debug.aar
122+
123+
- name: Verify release AAR exists in Maven Local
124+
run: stat ~/.m2/repository/com/rnapp/brownfieldlib/0.0.1-local/brownfieldlib-0.0.1-local-release.aar
125+
126+
# == AndroidApp ==
127+
128+
- name: Build native Android Brownfield app
129+
run: |
130+
yarn run build:example:android-consumer
131+
132+
ios:
88133
name: Integrated tester iOS App
89134
runs-on: macos-latest
90135
needs: build-lint
@@ -130,6 +175,26 @@ jobs:
130175
cd apps/TesterIntegrated/swift
131176
pod install
132177
178+
# == IntegratedTester ==
179+
133180
- name: Build integrated iOS tester app
134181
run: |
135182
yarn run build:tester-integrated:ios
183+
184+
# == RNApp ==
185+
186+
- name: Install pods (RNApp)
187+
run: |
188+
cd apps/RNApp/ios
189+
pod install
190+
191+
- name: Package iOS framework with the Brownfield CLI
192+
run: |
193+
cd apps/RNApp
194+
yarn run brownfield:package:ios
195+
196+
# == AppleApp ==
197+
198+
- name: Build Brownfield iOS native app
199+
run: |
200+
yarn run build:example:ios-consumer

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,6 @@ lib/
7979

8080
# Gradle
8181
secring.gpg
82+
83+
# Typescript
84+
**/*.tsbuildinfo

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
lib
3+
dist

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,21 @@ Depending on your needs, you may need to install CocoaPods in a subset of the be
88
- example React Native iOS app: `cd apps/RNApp/ios && pod install`
99
- integrated iOS tester app: `cd apps/TesterIntegrated/swift && pod install`
1010

11+
## Contributing changes
12+
13+
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.
14+
15+
## Publishing to npm
16+
17+
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.
18+
1119
## Scripts
1220

1321
- `lint` - runs linting on all JS/TS source files in the monorepo *[Turbo]*
1422
- `gradle-plugin:lint` - runs linting on the Brownfield Gradle plugin source code
1523
- `typecheck` - runs TypeScript type checking on all TS source files in the monorepo *[Turbo]*
1624
- `build` - runs all `build*` tasks in the Turbo repo - see below for more details *[Turbo]*
25+
- `dev` - runs all `dev` tasks in all workspaces
1726
- `release` - releases a new version of React Native Brownfield package using `release-it`
1827
- `brownfield:plugin:publish:local` - publishes the Brownfield Gradle plugin to your local Maven repository for testing purposes
1928
- `build:brownfield` - builds the React Native Brownfield package (`packages/react-native-brownfield`) *[Turbo]*

apps/AppleApp/Brownfield Apple App.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333

3434
/* Begin PBXFileReference section */
3535
793C76A72EEBF938008A2A34 /* Brownfield Apple App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Brownfield Apple App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
36-
79A9BC7E2EF5781F009EC2E3 /* BrownfieldLib.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = BrownfieldLib.xcframework; path = ../RNApp/ios/out/Release/BrownfieldLib.xcframework; sourceTree = SOURCE_ROOT; };
37-
79A9BC7F2EF5781F009EC2E3 /* hermesvm.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = hermesvm.xcframework; path = ../RNApp/ios/out/Release/hermesvm.xcframework; sourceTree = SOURCE_ROOT; };
38-
79A9BC802EF5781F009EC2E3 /* ReactBrownfield.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ReactBrownfield.xcframework; path = ../RNApp/ios/out/Release/ReactBrownfield.xcframework; sourceTree = SOURCE_ROOT; };
36+
79A9BC7E2EF5781F009EC2E3 /* BrownfieldLib.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = BrownfieldLib.xcframework; path = ../RNApp/ios/.brownfield/package/BrownfieldLib.xcframework; sourceTree = SOURCE_ROOT; };
37+
79A9BC7F2EF5781F009EC2E3 /* hermesvm.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = hermesvm.xcframework; path = ../RNApp/ios/.brownfield/package/hermesvm.xcframework; sourceTree = SOURCE_ROOT; };
38+
79A9BC802EF5781F009EC2E3 /* ReactBrownfield.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ReactBrownfield.xcframework; path = ../RNApp/ios/.brownfield/package/ReactBrownfield.xcframework; sourceTree = SOURCE_ROOT; };
3939
/* End PBXFileReference section */
4040

4141
/* Begin PBXFileSystemSynchronizedRootGroup section */

apps/RNApp/.eslintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": ["@react-native", "prettier"],
3+
"plugins": ["prettier"],
4+
"ignorePatterns": ["node_modules/", "lib/"]
5+
}

apps/RNApp/ios/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
out
1+
.brownfield

apps/RNApp/ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,7 +2438,7 @@ PODS:
24382438
- React-perflogger (= 0.82.1)
24392439
- React-utils (= 0.82.1)
24402440
- SocketRocket
2441-
- RNScreens (4.18.0):
2441+
- RNScreens (4.19.0):
24422442
- boost
24432443
- DoubleConversion
24442444
- fast_float
@@ -2465,10 +2465,10 @@ PODS:
24652465
- ReactCodegen
24662466
- ReactCommon/turbomodule/bridging
24672467
- ReactCommon/turbomodule/core
2468-
- RNScreens/common (= 4.18.0)
2468+
- RNScreens/common (= 4.19.0)
24692469
- SocketRocket
24702470
- Yoga
2471-
- RNScreens/common (4.18.0):
2471+
- RNScreens/common (4.19.0):
24722472
- boost
24732473
- DoubleConversion
24742474
- fast_float
@@ -2814,10 +2814,10 @@ SPEC CHECKSUMS:
28142814
ReactBrownfield: 1609c411abb926b1fd3c8557ef67d4138fb56a02
28152815
ReactCodegen: 0bce2d209e2e802589f4c5ff76d21618200e74cb
28162816
ReactCommon: 801eff8cb9c940c04d3a89ce399c343ee3eff654
2817-
RNScreens: 98771ad898d1c0528fc8139606bbacf5a2e9d237
2817+
RNScreens: d6413aeb1878cdafd3c721e2c5218faf5d5d3b13
28182818
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
28192819
Yoga: 46ff53afcbeda2bae19c85b65e17487c3e3984dd
28202820

2821-
PODFILE CHECKSUM: df18b5948daeaea0547157dc0e289b1adc4ed10c
2821+
PODFILE CHECKSUM: 7c116a16dd0744063c8c6293dbfc638c9d447c19
28222822

28232823
COCOAPODS: 1.15.2

apps/RNApp/ios/RNApp.xcodeproj/project.pbxproj

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,14 @@
291291
inputFileListPaths = (
292292
"${PODS_ROOT}/Target Support Files/Pods-RNApp/Pods-RNApp-frameworks-${CONFIGURATION}-input-files.xcfilelist",
293293
);
294+
inputPaths = (
295+
);
294296
name = "[CP] Embed Pods Frameworks";
295297
outputFileListPaths = (
296298
"${PODS_ROOT}/Target Support Files/Pods-RNApp/Pods-RNApp-frameworks-${CONFIGURATION}-output-files.xcfilelist",
297299
);
300+
outputPaths = (
301+
);
298302
runOnlyForDeploymentPostprocessing = 0;
299303
shellPath = /bin/sh;
300304
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNApp/Pods-RNApp-frameworks.sh\"\n";
@@ -330,10 +334,14 @@
330334
inputFileListPaths = (
331335
"${PODS_ROOT}/Target Support Files/Pods-RNApp-BrownfieldLib/Pods-RNApp-BrownfieldLib-resources-${CONFIGURATION}-input-files.xcfilelist",
332336
);
337+
inputPaths = (
338+
);
333339
name = "[CP] Copy Pods Resources";
334340
outputFileListPaths = (
335341
"${PODS_ROOT}/Target Support Files/Pods-RNApp-BrownfieldLib/Pods-RNApp-BrownfieldLib-resources-${CONFIGURATION}-output-files.xcfilelist",
336342
);
343+
outputPaths = (
344+
);
337345
runOnlyForDeploymentPostprocessing = 0;
338346
shellPath = /bin/sh;
339347
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNApp-BrownfieldLib/Pods-RNApp-BrownfieldLib-resources.sh\"\n";
@@ -389,10 +397,14 @@
389397
inputFileListPaths = (
390398
"${PODS_ROOT}/Target Support Files/Pods-RNApp/Pods-RNApp-resources-${CONFIGURATION}-input-files.xcfilelist",
391399
);
400+
inputPaths = (
401+
);
392402
name = "[CP] Copy Pods Resources";
393403
outputFileListPaths = (
394404
"${PODS_ROOT}/Target Support Files/Pods-RNApp/Pods-RNApp-resources-${CONFIGURATION}-output-files.xcfilelist",
395405
);
406+
outputPaths = (
407+
);
396408
runOnlyForDeploymentPostprocessing = 0;
397409
shellPath = /bin/sh;
398410
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNApp/Pods-RNApp-resources.sh\"\n";
@@ -437,7 +449,7 @@
437449
CURRENT_PROJECT_VERSION = 1;
438450
ENABLE_BITCODE = NO;
439451
INFOPLIST_FILE = RNApp/Info.plist;
440-
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
452+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
441453
LD_RUNPATH_SEARCH_PATHS = (
442454
"$(inherited)",
443455
"@executable_path/Frameworks",
@@ -464,7 +476,7 @@
464476
CLANG_ENABLE_MODULES = YES;
465477
CURRENT_PROJECT_VERSION = 1;
466478
INFOPLIST_FILE = RNApp/Info.plist;
467-
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
479+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
468480
LD_RUNPATH_SEARCH_PATHS = (
469481
"$(inherited)",
470482
"@executable_path/Frameworks",
@@ -507,7 +519,7 @@
507519
GENERATE_INFOPLIST_FILE = YES;
508520
INFOPLIST_KEY_NSHumanReadableCopyright = "";
509521
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
510-
IPHONEOS_DEPLOYMENT_TARGET = 26.1;
522+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
511523
LD_RUNPATH_SEARCH_PATHS = (
512524
"@executable_path/Frameworks",
513525
"@loader_path/Frameworks",
@@ -570,7 +582,7 @@
570582
GENERATE_INFOPLIST_FILE = YES;
571583
INFOPLIST_KEY_NSHumanReadableCopyright = "";
572584
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
573-
IPHONEOS_DEPLOYMENT_TARGET = 26.1;
585+
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
574586
LD_RUNPATH_SEARCH_PATHS = (
575587
"@executable_path/Frameworks",
576588
"@loader_path/Frameworks",

0 commit comments

Comments
 (0)