feat: brownfield config file#339
Open
Esemesek wants to merge 12 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Introduces a unified configuration file system for the Brownfield CLI (react-native-brownfield.config.{js,json} or package.json#react-native-brownfield), validated via JSON schema, and migrates the legacy package.json#brownie block under a nested brownie key.
Changes:
- Adds
config.ts(load + validate + apply) wired intoactionRunner, plus a published JSON schema and type exports. - Updates Brownie codegen to support both legacy and new config sources with a migration warning and conflict error.
- Updates example apps and docs to use the new configuration format.
Reviewed changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/config.ts | New module to load/validate/apply Brownfield config to commands |
| packages/cli/src/types.ts | New shared CLI/config type definitions |
| packages/cli/src/shared/utils/cli.ts | Wires addBrownfieldConfig into actionRunner |
| packages/cli/src/shared/utils/tests/cli.test.ts | Adds test for config integration in actionRunner |
| packages/cli/src/brownie/config.ts | Adds hasLegacyConfig and refactors package.json loading |
| packages/cli/src/brownie/commands/codegen.ts | Adds new-vs-legacy config handling and warning |
| packages/cli/src/brownie/tests/commands/codegen.test.ts | Adds test for conflicting configs error |
| packages/cli/src/brownie/index.ts | Exports BrownieConfig type |
| packages/cli/src/brownfield/commands/packageIos.ts | Switches to shared PackageIosOptions type |
| packages/cli/src/navigation/commands/codegen.ts | Formatting only |
| packages/cli/src/tests/config.test.ts | New tests for config loading, validation, and apply |
| packages/cli/schema.json | New JSON schema for the config |
| packages/cli/package.json | Adds ajv dependency and ./types export |
| packages/react-native-brownfield/src/index.ts | Re-exports BrownfieldConfig type |
| docs/docs/public/schema.json | Published copy of schema |
| docs/docs/public/package-json.schema.json | package.json schema extension |
| docs/docs/docs/api-reference/configuration.mdx | New configuration docs page |
| docs/docs/docs/api-reference/_meta.json | Adds new page to nav |
| docs/docs/docs/cli/brownfield.mdx | Adds config tip, removes --verbose row |
| docs/docs/docs/cli/brownie.mdx | Adds config tip |
| docs/docs/docs/getting-started/android.mdx | Adds config step, renumbers sections |
| docs/docs/docs/getting-started/ios.mdx | Adds config step, renumbers sections |
| docs/docs/docs/getting-started/quick-start.mdx | Adds link to config docs |
| apps/RNApp/react-native-brownfield.config.js | New sample JS config |
| apps/RNApp/package.json | Simplifies brownfield scripts |
| apps/ExpoApp54/react-native-brownfield.config.json | New sample JSON config |
| apps/ExpoApp54/package.json | Removes legacy brownie, simplifies scripts |
| apps/ExpoApp55/package.json | Migrates to new react-native-brownfield block |
| .vscode/settings.json | Registers schema for package.json autocomplete |
| yarn.lock | Adds ajv entry |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+30
to
31
| addBrownfieldConfig(...args); | ||
| await fn(...args); |
Comment on lines
+62
to
+64
| export function addBrownfieldConfig(...args: any[]): void { | ||
| // Last argument is the current command instance | ||
| const command = args.at(-1) as Command; |
| return require(jsonConfigFilePath) as BrownfieldConfig; | ||
| } | ||
|
|
||
| return packageJson[PACKAGE_JSON_CONFIG_KEY] || {}; |
Comment on lines
+14
to
+17
| export type BrownieConfig = { | ||
| kotlin?: string; | ||
| kotlinPackageName?: string; | ||
| }; |
Comment on lines
+1
to
+3
| import { type PackageAarFlags } from '@rock-js/platform-android'; | ||
|
|
||
| import { type PublishLocalAarFlags } from '@rock-js/platform-android'; |
Comment on lines
+101
to
+103
| const legacyConfig = hasLegacyConfig() ? loadConfig() : undefined; | ||
|
|
||
| if (legacyConfig && brownie) { |
| } | ||
| }); | ||
|
|
||
| it('applies config values to undefined CLI options', () => { |
| "@rock-js/plugin-brownfield-android": "^0.13.3", | ||
| "@rock-js/plugin-brownfield-ios": "^0.13.3", | ||
| "@rock-js/tools": "^0.13.3", | ||
| "ajv": "^6.14.0", |
Comment on lines
+110
to
+112
| logger.warn( | ||
| 'You are using legacy Brownie configuration. Please migrate to the new configuration format. See the documentation for more details: https://oss.callstack.com/react-native-brownfield/docs/api-reference/configuration#migrating-from-legacy-brownie-configuration' | ||
| ); |
| This creates the XCFramework in **`ios/.brownfield/package/build/`** (relative to your project root). | ||
|
|
||
| ## 6. Add the Framework to Your iOS App | ||
| If you prefer to keep the settings on the command line, you can still run `npx brownfield package:ios --scheme <framework_target_name> --configuration Release` instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #62
Test plan