Skip to content

feat: brownfield config file#339

Open
Esemesek wants to merge 12 commits into
callstack:mainfrom
Esemesek:feat/brownfield-config
Open

feat: brownfield config file#339
Esemesek wants to merge 12 commits into
callstack:mainfrom
Esemesek:feat/brownfield-config

Conversation

@Esemesek
Copy link
Copy Markdown

@Esemesek Esemesek commented May 19, 2026

Summary

Fixes #62

  • Added support for configurations files and configuration key in package.json
  • Generated schema.json file (from TS type definition) to support IDE suggestions in JSON files
  • Added UTs
  • Brownie config lives inside react-native-brownfield.config
  • Added deprecation notice for previous Brownie config
  • Updated docs

Test plan

  1. Add a configuration file in project that uses brownfield cli
  2. Run brownfield cli command and observe injected options from the configuration
  3. Run brownfield cli command and and pass additional CLI arguments and observe that arguments override the configuration keys

@Esemesek Esemesek marked this pull request as ready for review May 29, 2026 10:07
Copilot AI review requested due to automatic review settings May 29, 2026 10:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 into actionRunner, 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 thread packages/cli/src/types.ts
Comment on lines +14 to +17
export type BrownieConfig = {
kotlin?: string;
kotlinPackageName?: string;
};
Comment thread packages/cli/src/types.ts
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', () => {
Comment thread packages/cli/package.json
"@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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for configuration file

2 participants