Skip to content

feat: brownfield config file#339

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

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

Conversation

@Esemesek

@Esemesek Esemesek commented May 19, 2026

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 thread packages/cli/src/shared/utils/cli.ts Outdated
Comment thread packages/cli/src/config.ts Outdated
Comment thread packages/cli/src/config.ts Outdated
Comment thread packages/cli/src/types.ts
Comment thread packages/cli/src/types.ts Outdated
Comment thread packages/cli/src/brownie/commands/codegen.ts
Comment thread packages/cli/src/__tests__/config.test.ts Outdated
Comment thread packages/cli/package.json Outdated
Comment thread packages/cli/src/brownie/commands/codegen.ts
Comment thread docs/docs/docs/getting-started/ios.mdx
Comment thread apps/RNApp/brownfield.config.js Outdated
```js
/** @type {import('@callstack/react-native-brownfield').BrownfieldConfig} */
module.exports = {
moduleName: ':BrownfieldLib',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
moduleName: ':BrownfieldLib',
moduleName: 'BrownfieldLib',

Comment thread docs/docs/docs/api-reference/configuration.mdx Outdated
Comment thread docs/docs/docs/api-reference/configuration.mdx Outdated
Comment thread docs/docs/docs/api-reference/configuration.mdx Outdated
Comment thread packages/cli/src/brownfield/commands/packageIos.ts Outdated
Comment thread packages/cli/src/types.ts Outdated
Comment on lines +40 to +43
export type BrownfieldConfig = BrownfieldConfigMetadata &
BrownfieldCommonOptions &
BrownfieldAndroidConfig &
BrownfieldIosConfig & { brownie?: BrownieConfig };

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's adjust this to keep platform-specific options verbosely separated, so as not to confuse devs with what the options control:

BrownfieldConfigMetadata &
  BrownfieldCommonOptions &
  {android: BrownfieldAndroidConfig, ios: BrownfieldIosConfig}
 & { brownie?: BrownieConfig };

Comment thread packages/cli/schema.json Outdated
Comment on lines +1 to +8
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "React Native Brownfield CLI config",
"description": "Configuration for react-native-brownfield.config.json and package.json#react-native-brownfield.",
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should aim for automating generation of this schema e.g. using https://www.npmjs.com/package/typescript-json-schema. The current setup would increase the maintenance effort for us, while if we could auto-generate this (say, from a script in package.json + that would run on build + that would be run in precommit by lefthook - that would make it fully automated. We already have all the types in place.

The only matter to be checked is the docstrings for keys in types imported from Rock (i.e. if they are descriptive enough). If not - we can always make an intermediate type that is constrained to include all keys (no less, no more) from the Rock-imported type(s) and provide our own docstring override there.

@artus9033

Copy link
Copy Markdown
Collaborator

Hey! Solid work, I only left two comments.

@artus9033 artus9033 requested a review from hurali97 June 17, 2026 21:33

@hurali97 hurali97 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good work - Just take care of the below comments:

  • Add changeset for the changed packages
  • Inspect CI failures

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

4 participants