@callstack/brownfield-cli 3.13.1 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/brownfield/commands/packageAndroid.d.ts.map +1 -1
  3. package/dist/brownfield/commands/packageAndroid.js +3 -1
  4. package/dist/brownfield/commands/packageIos.d.ts +1 -0
  5. package/dist/brownfield/commands/packageIos.d.ts.map +1 -1
  6. package/dist/brownfield/commands/packageIos.js +37 -4
  7. package/dist/brownfield/commands/publishAndroid.d.ts.map +1 -1
  8. package/dist/brownfield/commands/publishAndroid.js +3 -1
  9. package/dist/brownfield/utils/createLocalSpmPackage.d.ts +2 -1
  10. package/dist/brownfield/utils/createLocalSpmPackage.d.ts.map +1 -1
  11. package/dist/brownfield/utils/createLocalSpmPackage.js +8 -2
  12. package/dist/brownfield/utils/emitExpoSupportXcframeworks.d.ts +9 -0
  13. package/dist/brownfield/utils/emitExpoSupportXcframeworks.d.ts.map +1 -0
  14. package/dist/brownfield/utils/emitExpoSupportXcframeworks.js +70 -0
  15. package/dist/brownfield/utils/normalizeCopiedXcframework.d.ts +3 -0
  16. package/dist/brownfield/utils/normalizeCopiedXcframework.d.ts.map +1 -0
  17. package/dist/brownfield/utils/normalizeCopiedXcframework.js +64 -0
  18. package/dist/brownfield/utils/prepareLocalSpmArtifacts.d.ts.map +1 -1
  19. package/dist/brownfield/utils/prepareLocalSpmArtifacts.js +2 -63
  20. package/dist/brownfield/utils/project.d.ts.map +1 -1
  21. package/dist/brownfield/utils/project.js +20 -9
  22. package/dist/brownfield/utils/supportsPrebuiltExpo.d.ts +14 -0
  23. package/dist/brownfield/utils/supportsPrebuiltExpo.d.ts.map +1 -0
  24. package/dist/brownfield/utils/supportsPrebuiltExpo.js +20 -0
  25. package/dist/brownie/config.js +1 -1
  26. package/dist/config.d.ts +4 -1
  27. package/dist/config.d.ts.map +1 -1
  28. package/dist/config.js +10 -7
  29. package/dist/expoPluginConfig.d.ts +74 -0
  30. package/dist/expoPluginConfig.d.ts.map +1 -0
  31. package/dist/expoPluginConfig.js +103 -0
  32. package/dist/types.d.ts +94 -3
  33. package/dist/types.d.ts.map +1 -1
  34. package/package.json +12 -6
  35. package/schema.json +98 -9
  36. package/src/brownfield/commands/packageAndroid.ts +4 -1
  37. package/src/brownfield/commands/packageIos.ts +53 -4
  38. package/src/brownfield/commands/publishAndroid.ts +4 -1
  39. package/src/brownfield/utils/createLocalSpmPackage.ts +15 -1
  40. package/src/brownfield/utils/emitExpoSupportXcframeworks.ts +132 -0
  41. package/src/brownfield/utils/normalizeCopiedXcframework.ts +90 -0
  42. package/src/brownfield/utils/prepareLocalSpmArtifacts.ts +7 -90
  43. package/src/brownfield/utils/project.ts +33 -14
  44. package/src/brownfield/utils/supportsPrebuiltExpo.ts +34 -0
  45. package/src/brownie/config.ts +1 -1
  46. package/src/config.ts +12 -8
  47. package/src/expoPluginConfig.ts +195 -0
  48. package/src/types.ts +112 -3
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAenD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAMjE;AAED,wBAAgB,oBAAoB,CAClC,WAAW,GAAE,MAA0B,GACtC,gBAAgB,CA2BlB;AAED,KAAK,kBAAkB,GAAG,SAAS,GAAG,KAAK,CAAC;AAe5C,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,EAC/D,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,kBAAkB,GAC3B,CAAC,CAwCH"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMnD,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAC7C,eAAO,MAAM,mBAAmB,yBAAkC,CAAC;AACnE,eAAO,MAAM,qBAAqB,2BAAoC,CAAC;AAOvE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAMjE;AAED,wBAAgB,oBAAoB,CAClC,WAAW,GAAE,MAA0B,GACtC,gBAAgB,GAAG,IAAI,CA+BzB;AAED,KAAK,kBAAkB,GAAG,SAAS,GAAG,KAAK,CAAC;AAe5C,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,MAAM,EAC/D,OAAO,EAAE,CAAC,EACV,QAAQ,EAAE,kBAAkB,GAC3B,CAAC,CAwCH"}
package/dist/config.js CHANGED
@@ -5,11 +5,11 @@ import Ajv from 'ajv';
5
5
  import { findProjectRoot } from './brownfield/utils/paths.js';
6
6
  import BrownfieldSchema from '../schema.json' with { type: 'json' };
7
7
  import { logger } from '@rock-js/tools';
8
- const CONFIG_BASE_NAME = 'brownfield';
9
- const JS_CONFIG_FILE_NAME = `${CONFIG_BASE_NAME}.config.js`;
10
- const JSON_CONFIG_FILE_NAME = `${CONFIG_BASE_NAME}.config.json`;
8
+ export const CONFIG_BASE_NAME = 'brownfield';
9
+ export const JS_CONFIG_FILE_NAME = `${CONFIG_BASE_NAME}.config.js`;
10
+ export const JSON_CONFIG_FILE_NAME = `${CONFIG_BASE_NAME}.config.json`;
11
11
  const SEPARATOR = '\n● ';
12
- const ajv = new Ajv({ allErrors: true });
12
+ const ajv = new Ajv({ allErrors: true, allowUnionTypes: true });
13
13
  const validateBrownfieldConfig = ajv.compile(BrownfieldSchema);
14
14
  export function validateBrownfieldCLIConfig(config) {
15
15
  if (!validateBrownfieldConfig(config)) {
@@ -25,7 +25,7 @@ export function loadBrownfieldConfig(projectRoot = findProjectRoot()) {
25
25
  if ([
26
26
  fs.existsSync(jsConfigFilePath),
27
27
  fs.existsSync(jsonConfigFilePath),
28
- packageJson[CONFIG_BASE_NAME],
28
+ CONFIG_BASE_NAME in packageJson,
29
29
  ].filter(Boolean).length > 1) {
30
30
  throw new Error('Project has multiple Brownfield configuration files');
31
31
  }
@@ -35,7 +35,10 @@ export function loadBrownfieldConfig(projectRoot = findProjectRoot()) {
35
35
  if (fs.existsSync(jsonConfigFilePath)) {
36
36
  return require(jsonConfigFilePath);
37
37
  }
38
- return packageJson[CONFIG_BASE_NAME] || {};
38
+ if (CONFIG_BASE_NAME in packageJson) {
39
+ return packageJson[CONFIG_BASE_NAME] ?? {};
40
+ }
41
+ return null;
39
42
  }
40
43
  function getSharedConfig(config) {
41
44
  return config.verbose === undefined ? {} : { verbose: config.verbose };
@@ -47,7 +50,7 @@ function areConfigValuesEqual(configValue, optionValue) {
47
50
  return JSON.stringify(configValue) === JSON.stringify(optionValue);
48
51
  }
49
52
  export function mergeBrownfieldConfigWithOptions(options, platform) {
50
- const reactNativeBrownfieldConfig = loadBrownfieldConfig();
53
+ const reactNativeBrownfieldConfig = loadBrownfieldConfig() ?? {};
51
54
  validateBrownfieldCLIConfig(reactNativeBrownfieldConfig);
52
55
  const platformConfig = {
53
56
  ...getSharedConfig(reactNativeBrownfieldConfig),
@@ -0,0 +1,74 @@
1
+ import type { BrownfieldConfig } from './types.js';
2
+ export { loadBrownfieldConfig } from './config.js';
3
+ /**
4
+ * Legacy Expo config plugin props shape accepted via app.json plugins tuple.
5
+ */
6
+ export type BrownfieldPluginProps = {
7
+ debug?: boolean;
8
+ ios?: {
9
+ frameworkName?: string;
10
+ bundleIdentifier?: string;
11
+ buildSettings?: Record<string, string | boolean | number>;
12
+ deploymentTarget?: string;
13
+ frameworkVersion?: string;
14
+ };
15
+ android?: {
16
+ moduleName?: string;
17
+ packageName?: string;
18
+ minSdkVersion?: number;
19
+ targetSdkVersion?: number;
20
+ compileSdkVersion?: number;
21
+ groupId?: string;
22
+ artifactId?: string;
23
+ version?: string;
24
+ useLocalGradlePlugin?: boolean;
25
+ };
26
+ };
27
+ export type ResolvedBrownfieldPluginAndroidConfig = {
28
+ moduleName: string;
29
+ packageName: string;
30
+ minSdkVersion: number;
31
+ targetSdkVersion: number;
32
+ compileSdkVersion: number;
33
+ groupId: string;
34
+ artifactId: string;
35
+ version: string;
36
+ useLocalGradlePlugin: boolean;
37
+ };
38
+ export type ResolvedBrownfieldPluginIosConfig = {
39
+ frameworkName: string;
40
+ bundleIdentifier: string;
41
+ buildSettings: Record<string, string | boolean | number>;
42
+ deploymentTarget: string;
43
+ frameworkVersion: string;
44
+ };
45
+ export type ResolvedBrownfieldPluginConfig = {
46
+ debug: boolean;
47
+ ios: ResolvedBrownfieldPluginIosConfig | null;
48
+ android: ResolvedBrownfieldPluginAndroidConfig | null;
49
+ };
50
+ type BrownfieldExpoConfig = {
51
+ ios?: {
52
+ bundleIdentifier?: string;
53
+ };
54
+ android?: {
55
+ package?: string;
56
+ };
57
+ };
58
+ /**
59
+ * Asserts that there is no overlap between the file config and the plugin props.
60
+ * @param fileConfig - The loaded file config, or null when no config source exists.
61
+ * @param pluginProps - The plugin props to check for overlap.
62
+ * @throws An error if there is overlap.
63
+ * @returns void
64
+ */
65
+ export declare function assertNoConfigFilePluginOverlap(fileConfig: BrownfieldConfig | null, pluginProps: BrownfieldPluginProps): void;
66
+ /**
67
+ * Resolves the plugin config from the file config and the plugin props.
68
+ * @param pluginProps - The plugin props to resolve.
69
+ * @param fileConfig - The file config to resolve.
70
+ * @param expoConfig - The Expo plugin config to resolve.
71
+ * @returns The resolved plugin config.
72
+ */
73
+ export declare function resolveBrownfieldPluginConfig(pluginProps: BrownfieldPluginProps, fileConfig: BrownfieldConfig | null, expoConfig: BrownfieldExpoConfig): ResolvedBrownfieldPluginConfig;
74
+ //# sourceMappingURL=expoPluginConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expoPluginConfig.d.ts","sourceRoot":"","sources":["../src/expoPluginConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAE,oBAAoB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MAAM,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,iCAAiC,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,qCAAqC,GAAG,IAAI,CAAC;CACvD,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAC1B,GAAG,CAAC,EAAE;QACJ,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AA0DF;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,gBAAgB,GAAG,IAAI,EACnC,WAAW,EAAE,qBAAqB,GACjC,IAAI,CAQN;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,qBAAqB,EAClC,UAAU,EAAE,gBAAgB,GAAG,IAAI,EACnC,UAAU,EAAE,oBAAoB,GAC/B,8BAA8B,CA2ChC"}
@@ -0,0 +1,103 @@
1
+ export { loadBrownfieldConfig } from './config.js';
2
+ const CONFIG_FILE_PLUGIN_OVERLAP_ERROR = 'Brownfield configuration is defined in both a brownfield config file and app.json plugin options. ' +
3
+ 'Use only one source: either brownfield.config.js, brownfield.config.json, package.json#brownfield, or the plugin options in app.json.';
4
+ /**
5
+ * Checks if the plugin props are non-empty.
6
+ * @param props - The plugin props to check.
7
+ * @returns True if the plugin props are non-empty, false otherwise.
8
+ */
9
+ function isPluginPropsNonEmpty(props) {
10
+ if (props.debug !== undefined) {
11
+ return true;
12
+ }
13
+ if (props.ios && Object.keys(props.ios).length > 0) {
14
+ return true;
15
+ }
16
+ if (props.android && Object.keys(props.android).length > 0) {
17
+ return true;
18
+ }
19
+ return false;
20
+ }
21
+ /**
22
+ * Converts the file config to plugin props.
23
+ * @param fileConfig - The file config to convert to plugin props.
24
+ * @returns The plugin props.
25
+ */
26
+ function fileConfigToPluginProps(fileConfig) {
27
+ const props = {};
28
+ if (fileConfig.verbose !== undefined) {
29
+ props.debug = fileConfig.verbose;
30
+ }
31
+ if (fileConfig.android) {
32
+ props.android = {
33
+ moduleName: fileConfig.android.moduleName,
34
+ ...fileConfig.android.expo,
35
+ };
36
+ }
37
+ if (fileConfig.ios) {
38
+ props.ios = {
39
+ frameworkName: fileConfig.ios.scheme,
40
+ ...fileConfig.ios.expo,
41
+ };
42
+ }
43
+ return props;
44
+ }
45
+ /**
46
+ * Asserts that there is no overlap between the file config and the plugin props.
47
+ * @param fileConfig - The loaded file config, or null when no config source exists.
48
+ * @param pluginProps - The plugin props to check for overlap.
49
+ * @throws An error if there is overlap.
50
+ * @returns void
51
+ */
52
+ export function assertNoConfigFilePluginOverlap(fileConfig, pluginProps) {
53
+ if (fileConfig === null) {
54
+ return;
55
+ }
56
+ if (isPluginPropsNonEmpty(pluginProps)) {
57
+ throw new Error(CONFIG_FILE_PLUGIN_OVERLAP_ERROR);
58
+ }
59
+ }
60
+ /**
61
+ * Resolves the plugin config from the file config and the plugin props.
62
+ * @param pluginProps - The plugin props to resolve.
63
+ * @param fileConfig - The file config to resolve.
64
+ * @param expoConfig - The Expo plugin config to resolve.
65
+ * @returns The resolved plugin config.
66
+ */
67
+ export function resolveBrownfieldPluginConfig(pluginProps, fileConfig, expoConfig) {
68
+ const effectiveProps = fileConfig !== null ? fileConfigToPluginProps(fileConfig) : pluginProps;
69
+ const androidPackage = expoConfig.android?.package;
70
+ /**
71
+ * Below: android.moduleName may be provided in the fully-qualified Gradle format
72
+ * (e.g. :BrownfieldLib — this is shown in the CLI example usage).
73
+ * The Expo prebuild side expects a raw module folder/name (it later
74
+ * prepends : itself and uses it as a path), so a leading : is removed.
75
+ */
76
+ const androidModuleName = (effectiveProps.android?.moduleName ?? 'brownfieldlib').replace(/^:/, '');
77
+ return {
78
+ debug: effectiveProps.debug ?? false,
79
+ ios: expoConfig.ios
80
+ ? {
81
+ frameworkName: effectiveProps.ios?.frameworkName ?? 'BrownfieldLib',
82
+ bundleIdentifier: effectiveProps.ios?.bundleIdentifier ??
83
+ `${expoConfig.ios.bundleIdentifier}.brownfield`,
84
+ buildSettings: effectiveProps.ios?.buildSettings ?? {},
85
+ deploymentTarget: effectiveProps.ios?.deploymentTarget ?? '15.0',
86
+ frameworkVersion: effectiveProps.ios?.frameworkVersion ?? '1',
87
+ }
88
+ : null,
89
+ android: androidPackage
90
+ ? {
91
+ moduleName: androidModuleName,
92
+ packageName: effectiveProps.android?.packageName ?? androidPackage,
93
+ minSdkVersion: effectiveProps.android?.minSdkVersion ?? 24,
94
+ targetSdkVersion: effectiveProps.android?.targetSdkVersion ?? 35,
95
+ compileSdkVersion: effectiveProps.android?.compileSdkVersion ?? 35,
96
+ groupId: effectiveProps.android?.groupId ?? androidPackage,
97
+ artifactId: effectiveProps.android?.artifactId ?? androidModuleName,
98
+ version: effectiveProps.android?.version ?? '0.0.1-SNAPSHOT',
99
+ useLocalGradlePlugin: effectiveProps.android?.useLocalGradlePlugin ?? false,
100
+ }
101
+ : null,
102
+ };
103
+ }
package/dist/types.d.ts CHANGED
@@ -2,29 +2,120 @@ import type { PublishLocalAarFlags, PackageAarFlags } from '@rock-js/platform-an
2
2
  import type { BuildFlags as AppleBuildFlags } from '@rock-js/platform-apple-helpers';
3
3
  export type Platform = 'swift' | 'kotlin';
4
4
  export type BrownfieldCommonOptions = Partial<{
5
+ /**
6
+ * Enables verbose CLI logging.
7
+ */
5
8
  verbose: boolean;
6
9
  }>;
7
10
  export type BrownfieldConfigMetadata = Partial<{
8
11
  $schema: string;
9
12
  }>;
10
13
  export type BrownieConfig = {
14
+ /**
15
+ * The output path to generate Kotlin Brownie store files at.
16
+ */
11
17
  kotlin?: string;
18
+ /**
19
+ * The package name for the Kotlin source code.
20
+ */
12
21
  kotlinPackageName?: string;
13
22
  };
14
- export type PackageIosOptions = AppleBuildFlags & {
23
+ export type PackageIosOptions = Omit<AppleBuildFlags, 'archive' | 'local'> & {
15
24
  /** Set when `--use-prebuilt-rn-core` is passed; omitted when the flag is absent (Rock applies RN version defaults). */
16
25
  usePrebuiltRnCore?: boolean;
26
+ /** Set when `--use-prebuilt-expo` is passed; omitted when the flag is absent (Rock applies Expo version defaults). */
27
+ usePrebuiltExpo?: boolean;
17
28
  /** When set, generate a local Swift Package Manager manifest next to the packaged XCFramework outputs. */
18
29
  addSpmPackage?: boolean;
19
30
  };
20
31
  export type BrownfieldPackageAndroidOptions = BrownfieldCommonOptions & Partial<PackageAarFlags>;
21
32
  export type BrownfieldPublishAndroidOptions = BrownfieldCommonOptions & Partial<PublishLocalAarFlags>;
22
33
  export type BrownfieldPackageIosOptions = BrownfieldCommonOptions & Partial<PackageIosOptions>;
23
- export type BrownfieldAndroidConfig = Omit<Partial<PackageAarFlags> & Partial<PublishLocalAarFlags>, keyof BrownfieldCommonOptions>;
24
- export type BrownfieldIosConfig = Omit<Partial<PackageIosOptions>, keyof BrownfieldCommonOptions>;
34
+ /**
35
+ * Expo config plugin options for Android prebuild scaffolding.
36
+ */
37
+ export type BrownfieldExpoAndroidConfig = {
38
+ /**
39
+ * The package name for the Android library module.
40
+ */
41
+ packageName?: string;
42
+ /**
43
+ * Minimum SDK version for the Android library.
44
+ */
45
+ minSdkVersion?: number;
46
+ /**
47
+ * Target SDK version for the Android library.
48
+ */
49
+ targetSdkVersion?: number;
50
+ /**
51
+ * Compile SDK version for the Android library.
52
+ */
53
+ compileSdkVersion?: number;
54
+ /**
55
+ * Maven group ID used when publishing the AAR.
56
+ */
57
+ groupId?: string;
58
+ /**
59
+ * Maven artifact ID used when publishing the AAR.
60
+ */
61
+ artifactId?: string;
62
+ /**
63
+ * Maven version used when publishing the AAR.
64
+ */
65
+ version?: string;
66
+ /**
67
+ * When true, load the Brownfield Gradle plugin from
68
+ * `@callstack/react-native-brownfield/gradle-plugin/brownfield` via
69
+ * `includeBuild` instead of adding the Maven classpath dependency.
70
+ * Disabled by default.
71
+ */
72
+ useLocalGradlePlugin?: boolean;
73
+ };
74
+ /**
75
+ * Expo config plugin options for iOS prebuild scaffolding.
76
+ */
77
+ export type BrownfieldExpoIosConfig = {
78
+ /**
79
+ * The bundle identifier for the framework.
80
+ */
81
+ bundleIdentifier?: string;
82
+ /**
83
+ * Custom build settings applied when building the framework.
84
+ */
85
+ buildSettings?: Record<string, string | boolean | number>;
86
+ /**
87
+ * Minimum iOS deployment target for the generated framework.
88
+ */
89
+ deploymentTarget?: string;
90
+ /**
91
+ * Framework version used for Apple build settings.
92
+ */
93
+ frameworkVersion?: string;
94
+ };
95
+ export type BrownfieldAndroidConfig = Omit<Partial<PackageAarFlags> & Partial<PublishLocalAarFlags>, keyof BrownfieldCommonOptions> & {
96
+ /**
97
+ * Expo config plugin options for Android Expo prebuild phase.
98
+ */
99
+ expo?: BrownfieldExpoAndroidConfig;
100
+ };
101
+ export type BrownfieldIosConfig = Omit<Partial<PackageIosOptions>, keyof BrownfieldCommonOptions> & {
102
+ /**
103
+ * Expo config plugin options for iOS Expo prebuild phase.
104
+ */
105
+ expo?: BrownfieldExpoIosConfig;
106
+ };
25
107
  export type BrownfieldConfig = BrownfieldConfigMetadata & BrownfieldCommonOptions & Partial<{
108
+ /**
109
+ * Brownfield Android configuration.
110
+ */
26
111
  android: BrownfieldAndroidConfig;
112
+ /**
113
+ * Brownfield iOS configuration.
114
+ */
27
115
  ios: BrownfieldIosConfig;
116
+ /**
117
+ * Brownie (state library) configuration.
118
+ */
28
119
  brownie: BrownieConfig;
29
120
  }>;
30
121
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@callstack/brownfield-cli",
3
- "version": "3.13.1",
3
+ "version": "3.14.0",
4
4
  "license": "MIT",
5
5
  "author": "Artur Morys-Magiera <artus9033@gmail.com>",
6
6
  "bin": {
@@ -42,6 +42,11 @@
42
42
  "types": "./dist/types.d.ts",
43
43
  "default": "./dist/types.js"
44
44
  },
45
+ "./expo-plugin-config": {
46
+ "source": "./src/expoPluginConfig.ts",
47
+ "types": "./dist/expoPluginConfig.d.ts",
48
+ "default": "./dist/expoPluginConfig.js"
49
+ },
45
50
  "./package.json": "./package.json"
46
51
  },
47
52
  "scripts": {
@@ -83,11 +88,11 @@
83
88
  "@expo/config": "^12.0.13",
84
89
  "@react-native-community/cli-config": "^20.0.0",
85
90
  "@react-native-community/cli-config-android": "^20.0.0",
86
- "@rock-js/platform-android": "^0.13.3",
87
- "@rock-js/platform-apple-helpers": "^0.13.3",
88
- "@rock-js/plugin-brownfield-android": "^0.13.3",
89
- "@rock-js/plugin-brownfield-ios": "^0.13.3",
90
- "@rock-js/tools": "^0.13.3",
91
+ "@rock-js/platform-android": "^0.14.0",
92
+ "@rock-js/platform-apple-helpers": "^0.14.0",
93
+ "@rock-js/plugin-brownfield-android": "^0.14.0",
94
+ "@rock-js/plugin-brownfield-ios": "^0.14.0",
95
+ "@rock-js/tools": "^0.14.0",
91
96
  "ajv": "^8.20.0",
92
97
  "commander": "^14.0.3",
93
98
  "quicktype-core": "^23.2.6",
@@ -108,6 +113,7 @@
108
113
  "eslint": "^9.39.3",
109
114
  "globals": "^17.3.0",
110
115
  "nodemon": "^3.1.14",
116
+ "prettier": "^3.8.1",
111
117
  "ts-json-schema-generator": "^2.9.0",
112
118
  "typescript": "5.9.3",
113
119
  "vitest": "^4.1.4"
package/schema.json CHANGED
@@ -5,10 +5,16 @@
5
5
  "BrownfieldAndroidConfig": {
6
6
  "additionalProperties": false,
7
7
  "properties": {
8
+ "expo": {
9
+ "$ref": "#/definitions/BrownfieldExpoAndroidConfig",
10
+ "description": "Expo config plugin options for Android Expo prebuild phase."
11
+ },
8
12
  "moduleName": {
13
+ "description": "AAR module name.",
9
14
  "type": "string"
10
15
  },
11
16
  "variant": {
17
+ "description": "Your app's build variant, which is constructed from build type and product flavor, e.g. 'debug' or 'freeRelease'.",
12
18
  "type": "string"
13
19
  }
14
20
  },
@@ -21,16 +27,85 @@
21
27
  "type": "string"
22
28
  },
23
29
  "android": {
24
- "$ref": "#/definitions/BrownfieldAndroidConfig"
30
+ "$ref": "#/definitions/BrownfieldAndroidConfig",
31
+ "description": "Brownfield Android configuration."
25
32
  },
26
33
  "brownie": {
27
- "$ref": "#/definitions/BrownieConfig"
34
+ "$ref": "#/definitions/BrownieConfig",
35
+ "description": "Brownie (state library) configuration."
28
36
  },
29
37
  "ios": {
30
- "$ref": "#/definitions/BrownfieldIosConfig"
38
+ "$ref": "#/definitions/BrownfieldIosConfig",
39
+ "description": "Brownfield iOS configuration."
31
40
  },
32
41
  "verbose": {
42
+ "description": "Enables verbose CLI logging.",
43
+ "type": "boolean"
44
+ }
45
+ },
46
+ "type": "object"
47
+ },
48
+ "BrownfieldExpoAndroidConfig": {
49
+ "additionalProperties": false,
50
+ "description": "Expo config plugin options for Android prebuild scaffolding.",
51
+ "properties": {
52
+ "artifactId": {
53
+ "description": "Maven artifact ID used when publishing the AAR.",
54
+ "type": "string"
55
+ },
56
+ "compileSdkVersion": {
57
+ "description": "Compile SDK version for the Android library.",
58
+ "type": "number"
59
+ },
60
+ "groupId": {
61
+ "description": "Maven group ID used when publishing the AAR.",
62
+ "type": "string"
63
+ },
64
+ "minSdkVersion": {
65
+ "description": "Minimum SDK version for the Android library.",
66
+ "type": "number"
67
+ },
68
+ "packageName": {
69
+ "description": "The package name for the Android library module.",
70
+ "type": "string"
71
+ },
72
+ "targetSdkVersion": {
73
+ "description": "Target SDK version for the Android library.",
74
+ "type": "number"
75
+ },
76
+ "useLocalGradlePlugin": {
77
+ "description": "When true, load the Brownfield Gradle plugin from `@callstack/react-native-brownfield/gradle-plugin/brownfield` via `includeBuild` instead of adding the Maven classpath dependency. Disabled by default.",
33
78
  "type": "boolean"
79
+ },
80
+ "version": {
81
+ "description": "Maven version used when publishing the AAR.",
82
+ "type": "string"
83
+ }
84
+ },
85
+ "type": "object"
86
+ },
87
+ "BrownfieldExpoIosConfig": {
88
+ "additionalProperties": false,
89
+ "description": "Expo config plugin options for iOS prebuild scaffolding.",
90
+ "properties": {
91
+ "buildSettings": {
92
+ "additionalProperties": {
93
+ "type": ["string", "boolean", "number"]
94
+ },
95
+ "description": "Custom build settings applied when building the framework.",
96
+ "type": "object"
97
+ },
98
+ "bundleIdentifier": {
99
+ "description": "The bundle identifier for the framework.",
100
+ "type": "string"
101
+ },
102
+ "deploymentTarget": {
103
+ "description": "Minimum iOS deployment target for the generated framework.",
104
+ "type": "string"
105
+ },
106
+ "frameworkVersion": {
107
+ "description": "Framework version used for Apple build settings.",
108
+ "type": "string"
34
109
  }
35
110
  },
36
111
  "type": "object"
@@ -42,51 +117,63 @@
42
117
  "description": "When set, generate a local Swift Package Manager manifest next to the packaged XCFramework outputs.",
43
118
  "type": "boolean"
44
119
  },
45
- "archive": {
46
- "type": "boolean"
47
- },
48
120
  "buildFolder": {
121
+ "description": "Location for iOS build artifacts.",
49
122
  "type": "string"
50
123
  },
51
124
  "configuration": {
125
+ "description": "Xcode scheme configuration (case sensitive).",
52
126
  "type": "string"
53
127
  },
54
128
  "destination": {
129
+ "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\".",
55
130
  "items": {
56
131
  "type": "string"
57
132
  },
58
133
  "type": "array"
59
134
  },
135
+ "expo": {
136
+ "$ref": "#/definitions/BrownfieldExpoIosConfig",
137
+ "description": "Expo config plugin options for iOS Expo prebuild phase."
138
+ },
60
139
  "exportExtraParams": {
140
+ "description": "Custom xcodebuild export archive parameters.",
61
141
  "items": {
62
142
  "type": "string"
63
143
  },
64
144
  "type": "array"
65
145
  },
66
146
  "exportOptionsPlist": {
147
+ "description": "Export options file name for archiving (default: ExportOptions.plist).",
67
148
  "type": "string"
68
149
  },
69
150
  "extraParams": {
151
+ "description": "Custom xcodebuild parameters.",
70
152
  "items": {
71
153
  "type": "string"
72
154
  },
73
155
  "type": "array"
74
156
  },
75
157
  "installPods": {
76
- "type": "boolean"
77
- },
78
- "local": {
158
+ "description": "Whether to install CocoaPods.",
79
159
  "type": "boolean"
80
160
  },
81
161
  "newArch": {
162
+ "description": "Whether to build in new architecture.",
82
163
  "type": "boolean"
83
164
  },
84
165
  "scheme": {
166
+ "description": "Xcode scheme to use.",
85
167
  "type": "string"
86
168
  },
87
169
  "target": {
170
+ "description": "Xcode target to use.",
88
171
  "type": "string"
89
172
  },
173
+ "usePrebuiltExpo": {
174
+ "description": "Set when `--use-prebuilt-expo` is passed; omitted when the flag is absent (Rock applies Expo version defaults).",
175
+ "type": "boolean"
176
+ },
90
177
  "usePrebuiltRnCore": {
91
178
  "description": "Set when `--use-prebuilt-rn-core` is passed; omitted when the flag is absent (Rock applies RN version defaults).",
92
179
  "type": "boolean"
@@ -98,9 +185,11 @@
98
185
  "additionalProperties": false,
99
186
  "properties": {
100
187
  "kotlin": {
188
+ "description": "The output path to generate Kotlin Brownie store files at.",
101
189
  "type": "string"
102
190
  },
103
191
  "kotlinPackageName": {
192
+ "description": "The package name for the Kotlin source code.",
104
193
  "type": "string"
105
194
  }
106
195
  },
@@ -12,6 +12,7 @@ import {
12
12
  curryOptions,
13
13
  } from '../../shared/index.js';
14
14
  import { runExpoPrebuildIfNeeded } from '../utils/expo.js';
15
+ import { findProjectRoot } from '../utils/paths.js';
15
16
  import { getProjectInfo } from '../utils/project.js';
16
17
  import { runBrownieCodegenIfApplicable } from '../../brownie/helpers/runBrownieCodegenIfApplicable.js';
17
18
  import { runNavigationCodegenIfApplicable } from '../../navigation/helpers/runNavigationCodegenIfApplicable.js';
@@ -23,13 +24,15 @@ export const packageAndroidCommand = curryOptions(
23
24
  ).action(
24
25
  actionRunner(async (cliOptions: PackageAarFlags) => {
25
26
  const options = mergeBrownfieldConfigWithOptions(cliOptions, 'android');
27
+ const projectRoot = findProjectRoot();
26
28
 
27
- const { projectRoot, platformConfig } = getProjectInfo('android');
28
29
  await runExpoPrebuildIfNeeded({
29
30
  projectRoot,
30
31
  platform: 'android',
31
32
  });
32
33
 
34
+ const { platformConfig } = getProjectInfo('android');
35
+
33
36
  await runBrownieCodegenIfApplicable(projectRoot, 'kotlin');
34
37
  await runNavigationCodegenIfApplicable(projectRoot);
35
38