diff --git a/.changeset/young-snails-lose.md b/.changeset/young-snails-lose.md new file mode 100644 index 00000000..69abe525 --- /dev/null +++ b/.changeset/young-snails-lose.md @@ -0,0 +1,5 @@ +--- +'@callstack/brownfield-cli': patch +--- + +fix: generate config schema with descriptions, add more descriptions diff --git a/apps/AppleApp/package.json b/apps/AppleApp/package.json index 534b5501..4f732cb0 100644 --- a/apps/AppleApp/package.json +++ b/apps/AppleApp/package.json @@ -19,7 +19,7 @@ }, "devDependencies": { "@callstack/brownfield-example-shared-tests": "workspace:^", - "@rock-js/tools": "^0.13.3", + "@rock-js/tools": "^0.13.5", "detox": "^20.27.0", "jest": "^29.7.0" } diff --git a/docs/docs/docs/api-reference/configuration.mdx b/docs/docs/docs/api-reference/configuration.mdx index b24783d2..5577a06c 100644 --- a/docs/docs/docs/api-reference/configuration.mdx +++ b/docs/docs/docs/api-reference/configuration.mdx @@ -46,6 +46,14 @@ module.exports = { If you want schema autocomplete and validation directly in the config file, use `react-native-brownfield.config.json`: +> [!TIP] +> +> The schema URL is not required, but it's recommended to include it for autocomplete and validation. If you want to use it, you may need to configure `oss.callstack.com` as a trusted domain in your IDE. +> +> In VS Code, you can do it by adding `oss.callstack.com` to `JSON › Schema Download: Trusted Domains` in your preferences. +> +> In Cursor, it is sufficient to enable `JSON › Schema Download: Enable` in preferences. + ```json { "$schema": "https://oss.callstack.com/react-native-brownfield/schema.json", @@ -116,13 +124,11 @@ All file-based platform options mirror CLI flags, but they use camelCase propert | `ios.target` | `string` | Explicit Xcode target name. | | `ios.destination` | `string[]` | One or more Xcode destinations, such as `simulator`, `device`, or full destination strings. | | `ios.buildFolder` | `string` | Custom build output directory. By default, Brownfield uses the `.brownfield/build` path inside the iOS project. | -| `ios.archive` | `boolean` | Creates an archive build suitable for IPA export and distribution. | | `ios.extraParams` | `string[]` | Extra arguments passed to `xcodebuild`. | | `ios.exportExtraParams` | `string[]` | Extra arguments passed to the archive export step. | | `ios.exportOptionsPlist` | `string` | Export options plist filename used during archive export. | | `ios.installPods` | `boolean` | Controls automatic CocoaPods installation. Set `false` to match `--no-install-pods`. | | `ios.newArch` | `boolean` | Controls React Native new architecture support. Set `false` to match `--no-new-arch`. | -| `ios.local` | `boolean` | Forces a local `xcodebuild` flow. | | `ios.usePrebuiltRnCore` | `boolean` | Controls whether iOS packaging uses React Native Apple prebuilts. Omit it to keep Brownfield's version-aware defaults. | | `ios.addSpmPackage` | `boolean` | Generates a local Swift Package Manager manifest next to the packaged XCFramework outputs. | diff --git a/docs/docs/docs/cli/brownfield.mdx b/docs/docs/docs/cli/brownfield.mdx index 4fb142ba..2f30421a 100644 --- a/docs/docs/docs/cli/brownfield.mdx +++ b/docs/docs/docs/cli/brownfield.mdx @@ -36,12 +36,10 @@ Available arguments: | --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 '\/.brownfield/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 | -| --add-spm-package | Generate a local `Package.swift` next to the packaged XCFramework outputs so the folder can be added to Xcode as a local Swift Package | +| --add-spm-package | Generate a local `Package.swift` next to the packaged XCFramework outputs so the folder can be added to Xcode as a local Swift Package | | --use-prebuilt-rn-core [bool] | Controls usage of React Native Apple prebuilt binaries for the packaging Xcode build. Omit for version-aware defaults (see [Getting Started — iOS — React Native Prebuilts](/docs/getting-started/ios#react-native-prebuilts)). Pass `true`, `false`, or use the flag without a value as shorthand for `true`. Supported only for Expo 55+ OR vanilla RN >= 0.81. | | --no-install-pods | Skip automatic CocoaPods installation | | --no-new-arch | Run React Native in legacy async architecture | -| --local | Force local build with xcodebuild | The build directory will be placed in the `/.brownfield/build` folder by default and the build outputs (XCFrameworks) will be created in the `/.brownfield/package/build` folder: diff --git a/packages/cli/package.json b/packages/cli/package.json index e4ff5d50..a53fa2cd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -83,11 +83,11 @@ "@expo/config": "^12.0.13", "@react-native-community/cli-config": "^20.0.0", "@react-native-community/cli-config-android": "^20.0.0", - "@rock-js/platform-android": "^0.13.3", - "@rock-js/platform-apple-helpers": "^0.13.3", - "@rock-js/plugin-brownfield-android": "^0.13.3", - "@rock-js/plugin-brownfield-ios": "^0.13.3", - "@rock-js/tools": "^0.13.3", + "@rock-js/platform-android": "^0.13.5", + "@rock-js/platform-apple-helpers": "^0.13.5", + "@rock-js/plugin-brownfield-android": "^0.13.5", + "@rock-js/plugin-brownfield-ios": "^0.13.5", + "@rock-js/tools": "^0.13.5", "ajv": "^8.20.0", "commander": "^14.0.3", "quicktype-core": "^23.2.6", @@ -108,6 +108,7 @@ "eslint": "^9.39.3", "globals": "^17.3.0", "nodemon": "^3.1.14", + "prettier": "^3.8.1", "ts-json-schema-generator": "^2.9.0", "typescript": "5.9.3", "vitest": "^4.1.4" diff --git a/packages/cli/schema.json b/packages/cli/schema.json index 00ee5b71..25e22adc 100644 --- a/packages/cli/schema.json +++ b/packages/cli/schema.json @@ -6,9 +6,11 @@ "additionalProperties": false, "properties": { "moduleName": { + "description": "AAR module name.", "type": "string" }, "variant": { + "description": "Your app's build variant, which is constructed from build type and product flavor, e.g. 'debug' or 'freeRelease'.", "type": "string" } }, @@ -21,15 +23,19 @@ "type": "string" }, "android": { - "$ref": "#/definitions/BrownfieldAndroidConfig" + "$ref": "#/definitions/BrownfieldAndroidConfig", + "description": "Brownfield Android configuration." }, "brownie": { - "$ref": "#/definitions/BrownieConfig" + "$ref": "#/definitions/BrownieConfig", + "description": "Brownie (state library) configuration." }, "ios": { - "$ref": "#/definitions/BrownfieldIosConfig" + "$ref": "#/definitions/BrownfieldIosConfig", + "description": "Brownfield iOS configuration." }, "verbose": { + "description": "Enables verbose CLI logging.", "type": "boolean" } }, @@ -42,49 +48,53 @@ "description": "When set, generate a local Swift Package Manager manifest next to the packaged XCFramework outputs.", "type": "boolean" }, - "archive": { - "type": "boolean" - }, "buildFolder": { + "description": "Location for iOS build artifacts.", "type": "string" }, "configuration": { + "description": "Xcode scheme configuration (case sensitive).", "type": "string" }, "destination": { + "description": "Destination(s) for the build. You can pass multiple destinations as separate values or repeated use of the flag. Values can be either: \"simulator\", \"device\" or destinations supported by \"xcodebuild -destination\" flag, e.g. \"generic/platform=iOS\".", "items": { "type": "string" }, "type": "array" }, "exportExtraParams": { + "description": "Custom xcodebuild export archive parameters.", "items": { "type": "string" }, "type": "array" }, "exportOptionsPlist": { + "description": "Export options file name for archiving (default: ExportOptions.plist).", "type": "string" }, "extraParams": { + "description": "Custom xcodebuild parameters.", "items": { "type": "string" }, "type": "array" }, "installPods": { - "type": "boolean" - }, - "local": { + "description": "Whether to install CocoaPods.", "type": "boolean" }, "newArch": { + "description": "Whether to build in new architecture.", "type": "boolean" }, "scheme": { + "description": "Xcode scheme to use.", "type": "string" }, "target": { + "description": "Xcode target to use.", "type": "string" }, "usePrebuiltRnCore": { @@ -98,9 +108,11 @@ "additionalProperties": false, "properties": { "kotlin": { + "description": "The output path to generate Kotlin Brownie store files at.", "type": "string" }, "kotlinPackageName": { + "description": "The package name for the Kotlin source code.", "type": "string" } }, diff --git a/packages/cli/src/types.ts b/packages/cli/src/types.ts index 33d04cd6..fa316512 100644 --- a/packages/cli/src/types.ts +++ b/packages/cli/src/types.ts @@ -7,6 +7,9 @@ import type { BuildFlags as AppleBuildFlags } from '@rock-js/platform-apple-help export type Platform = 'swift' | 'kotlin'; export type BrownfieldCommonOptions = Partial<{ + /** + * Enables verbose CLI logging. + */ verbose: boolean; }>; @@ -15,13 +18,21 @@ export type BrownfieldConfigMetadata = Partial<{ }>; export type BrownieConfig = { + /** + * The output path to generate Kotlin Brownie store files at. + */ kotlin?: string; + + /** + * The package name for the Kotlin source code. + */ kotlinPackageName?: string; }; -export type PackageIosOptions = AppleBuildFlags & { +export type PackageIosOptions = Omit & { /** Set when `--use-prebuilt-rn-core` is passed; omitted when the flag is absent (Rock applies RN version defaults). */ usePrebuiltRnCore?: boolean; + /** When set, generate a local Swift Package Manager manifest next to the packaged XCFramework outputs. */ addSpmPackage?: boolean; }; @@ -45,7 +56,18 @@ export type BrownfieldIosConfig = Omit< export type BrownfieldConfig = BrownfieldConfigMetadata & BrownfieldCommonOptions & Partial<{ + /** + * Brownfield Android configuration. + */ android: BrownfieldAndroidConfig; + + /** + * Brownfield iOS configuration. + */ ios: BrownfieldIosConfig; + + /** + * Brownie (state library) configuration. + */ brownie: BrownieConfig; }>; diff --git a/yarn.lock b/yarn.lock index 0071766a..bee3be11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1679,11 +1679,11 @@ __metadata: "@react-native-community/cli-types": "npm:^20.0.0" "@react-native/babel-preset": "npm:0.82.1" "@react-native/eslint-config": "npm:0.82.1" - "@rock-js/platform-android": "npm:^0.13.3" - "@rock-js/platform-apple-helpers": "npm:^0.13.3" - "@rock-js/plugin-brownfield-android": "npm:^0.13.3" - "@rock-js/plugin-brownfield-ios": "npm:^0.13.3" - "@rock-js/tools": "npm:^0.13.3" + "@rock-js/platform-android": "npm:^0.13.5" + "@rock-js/platform-apple-helpers": "npm:^0.13.5" + "@rock-js/plugin-brownfield-android": "npm:^0.13.5" + "@rock-js/plugin-brownfield-ios": "npm:^0.13.5" + "@rock-js/tools": "npm:^0.13.5" "@types/babel__core": "npm:^7.20.5" "@types/babel__preset-env": "npm:^7.10.0" "@types/node": "npm:^25.5.0" @@ -1693,6 +1693,7 @@ __metadata: eslint: "npm:^9.39.3" globals: "npm:^17.3.0" nodemon: "npm:^3.1.14" + prettier: "npm:^3.8.1" quicktype-core: "npm:^23.2.6" quicktype-typescript-input: "npm:^23.2.6" ts-json-schema-generator: "npm:^2.9.0" @@ -1809,7 +1810,7 @@ __metadata: resolution: "@callstack/brownfield-example-ios-app@workspace:apps/AppleApp" dependencies: "@callstack/brownfield-example-shared-tests": "workspace:^" - "@rock-js/tools": "npm:^0.13.3" + "@rock-js/tools": "npm:^0.13.5" detox: "npm:^20.27.0" jest: "npm:^29.7.0" languageName: unknown @@ -5836,59 +5837,59 @@ __metadata: languageName: node linkType: hard -"@rock-js/platform-android@npm:^0.13.3": - version: 0.13.3 - resolution: "@rock-js/platform-android@npm:0.13.3" +"@rock-js/platform-android@npm:^0.13.5": + version: 0.13.5 + resolution: "@rock-js/platform-android@npm:0.13.5" dependencies: "@react-native-community/cli-config-android": "npm:^20.0.0" - "@rock-js/tools": "npm:^0.13.3" + "@rock-js/tools": "npm:^0.13.5" tslib: "npm:^2.3.0" - checksum: 10/00c15b4364b8f168d0159529782604ce22d67fc1e0dd05b25168e5cf8feb3226f3190d1d8a3995fe2b3eb937d6b016a422a6d07f66a32f163a9ea1db3f85e97c + checksum: 10/21819b2d76ae8277ebcf3798598bdc89bc27c09c218ddae7ffb5498e4e9e597e7294aebc5b5381417991576e48ec273a7c21c24b088616eb2126addf70a1d7ae languageName: node linkType: hard -"@rock-js/platform-apple-helpers@npm:^0.13.3": - version: 0.13.3 - resolution: "@rock-js/platform-apple-helpers@npm:0.13.3" +"@rock-js/platform-apple-helpers@npm:^0.13.5": + version: 0.13.5 + resolution: "@rock-js/platform-apple-helpers@npm:0.13.5" dependencies: "@react-native-community/cli-config": "npm:^20.0.0" "@react-native-community/cli-config-apple": "npm:^20.0.0" - "@rock-js/tools": "npm:^0.13.3" + "@rock-js/tools": "npm:^0.13.5" adm-zip: "npm:^0.5.16" fast-xml-parser: "npm:^4.5.0" tslib: "npm:^2.3.0" - checksum: 10/3e66ce7833bbe85ea035540087d17047d69d455b4c25116eb88377cc589319e6cecd1bcaee525011f5ec85ce727029ac6f2b13760dfc6f174495ea95e7cc3fde + checksum: 10/e53171a46e2ad0db574009ba4d66fcb6b22f5243d334662cb506c9d2aaf60574bf30f9537204e84bdf486627b2796da47cd7592a5aaaaba72ea3ca345bb31b10 languageName: node linkType: hard -"@rock-js/plugin-brownfield-android@npm:^0.13.3": - version: 0.13.3 - resolution: "@rock-js/plugin-brownfield-android@npm:0.13.3" +"@rock-js/plugin-brownfield-android@npm:^0.13.5": + version: 0.13.5 + resolution: "@rock-js/plugin-brownfield-android@npm:0.13.5" dependencies: "@react-native-community/cli-config-android": "npm:^20.0.0" - "@rock-js/platform-android": "npm:^0.13.3" - "@rock-js/tools": "npm:^0.13.3" + "@rock-js/platform-android": "npm:^0.13.5" + "@rock-js/tools": "npm:^0.13.5" tslib: "npm:^2.3.0" - checksum: 10/ecb183c2fbeb1b989b2340e4abd20030500df74bdb629855800ed97cd1a83c2e4a671890d65f11e8f802d00b0e36619bef64c09a7a39f071403ba52d9d291791 + checksum: 10/77a32e463986b7f08919dfa54d6cb54868cc0f38de6ab381a5e9a07b549cc4c9b23f6e95135373d529b0619b0548172fa19cbc9affc98d0fabd79dff56ef8853 languageName: node linkType: hard -"@rock-js/plugin-brownfield-ios@npm:^0.13.3": - version: 0.13.3 - resolution: "@rock-js/plugin-brownfield-ios@npm:0.13.3" +"@rock-js/plugin-brownfield-ios@npm:^0.13.5": + version: 0.13.5 + resolution: "@rock-js/plugin-brownfield-ios@npm:0.13.5" dependencies: "@react-native-community/cli-config-apple": "npm:^20.0.0" "@react-native-community/cli-types": "npm:^20.0.0" - "@rock-js/platform-apple-helpers": "npm:^0.13.3" - "@rock-js/tools": "npm:^0.13.3" + "@rock-js/platform-apple-helpers": "npm:^0.13.5" + "@rock-js/tools": "npm:^0.13.5" tslib: "npm:^2.3.0" - checksum: 10/4dbd9c3f4a0985126c946f30d910fcdadf110e8f1ace3c188105128f007080dfd42b51d7bb18b65a55d1f7af8fff562e0113cffe8475bfd8398a2cc87cad951f + checksum: 10/9b39f350286b463575621efba9cd0a4496e8cc8ed601e1b29649afca73f2ed8529a6b7738ef7f351b815a2e3e068fedca6aa8fe0ab80c2521aae4d23da33e994 languageName: node linkType: hard -"@rock-js/tools@npm:^0.13.3": - version: 0.13.3 - resolution: "@rock-js/tools@npm:0.13.3" +"@rock-js/tools@npm:^0.13.5": + version: 0.13.5 + resolution: "@rock-js/tools@npm:0.13.5" dependencies: "@clack/prompts": "npm:^0.11.0" adm-zip: "npm:^0.5.16" @@ -5900,7 +5901,7 @@ __metadata: string-argv: "npm:^0.3.2" tar: "npm:^7.5.1" tslib: "npm:^2.3.0" - checksum: 10/5034f552e8dcaf3aedaa8f511cb08d073672ff76c37faeb07d35aacf2188082477d196065de8d6fc06f429eda64542d497797436a1179c19c26b72a71bbe6bc2 + checksum: 10/7731aee927e3895ac9ff265eccab7c62f388f54f91bd1f01ce9155a960172efb59598463c35ef5438990f51bcce00355b8ac877f0755612e689cf5ff0dd76f90 languageName: node linkType: hard