@callstack/brownfield-cli 3.12.0 → 3.13.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 +6 -0
  2. package/dist/brownfield/commands/packageAndroid.d.ts.map +1 -1
  3. package/dist/brownfield/commands/packageAndroid.js +3 -3
  4. package/dist/brownfield/commands/packageIos.d.ts.map +1 -1
  5. package/dist/brownfield/commands/packageIos.js +4 -2
  6. package/dist/brownfield/commands/publishAndroid.d.ts.map +1 -1
  7. package/dist/brownfield/commands/publishAndroid.js +3 -1
  8. package/dist/brownie/commands/codegen.d.ts +4 -2
  9. package/dist/brownie/commands/codegen.d.ts.map +1 -1
  10. package/dist/brownie/commands/codegen.js +15 -7
  11. package/dist/brownie/config.d.ts +19 -5
  12. package/dist/brownie/config.d.ts.map +1 -1
  13. package/dist/brownie/config.js +45 -9
  14. package/dist/brownie/helpers/runBrownieCodegenIfApplicable.d.ts +1 -1
  15. package/dist/brownie/helpers/runBrownieCodegenIfApplicable.d.ts.map +1 -1
  16. package/dist/brownie/helpers/runBrownieCodegenIfApplicable.js +1 -1
  17. package/dist/brownie/index.d.ts +0 -1
  18. package/dist/brownie/index.d.ts.map +1 -1
  19. package/dist/config.d.ts +7 -0
  20. package/dist/config.d.ts.map +1 -0
  21. package/dist/config.js +72 -0
  22. package/dist/navigation/commands/codegen.d.ts.map +1 -1
  23. package/dist/navigation/generators/ts.d.ts.map +1 -1
  24. package/dist/navigation/generators/ts.js +53 -4
  25. package/dist/navigation/runner.d.ts.map +1 -1
  26. package/dist/navigation/runner.js +16 -12
  27. package/dist/shared/utils/cli.d.ts +1 -1
  28. package/dist/shared/utils/cli.d.ts.map +1 -1
  29. package/dist/types.d.ts +30 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/package.json +9 -1
  32. package/src/brownfield/commands/packageAndroid.ts +5 -6
  33. package/src/brownfield/commands/packageIos.ts +18 -18
  34. package/src/brownfield/commands/publishAndroid.ts +4 -1
  35. package/src/brownie/commands/codegen.ts +35 -10
  36. package/src/brownie/config.ts +72 -15
  37. package/src/brownie/helpers/runBrownieCodegenIfApplicable.ts +2 -2
  38. package/src/brownie/index.ts +0 -1
  39. package/src/config.ts +119 -0
  40. package/src/navigation/commands/codegen.ts +1 -3
  41. package/src/navigation/generators/ts.ts +61 -3
  42. package/src/navigation/runner.ts +17 -12
  43. package/src/shared/utils/cli.ts +4 -2
  44. package/src/types.ts +51 -0
  45. package/dist/brownie/types.d.ts +0 -2
  46. package/dist/brownie/types.d.ts.map +0 -1
  47. package/src/brownie/types.ts +0 -1
  48. /package/dist/{brownie/types.js → types.js} +0 -0
@@ -122,47 +122,52 @@ function getOutputPaths(
122
122
  };
123
123
  }
124
124
 
125
+ function writeFileEnsuringDir(filePath: string, content: string): void {
126
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
127
+ fs.writeFileSync(filePath, content);
128
+ }
129
+
125
130
  function writeArtifacts(
126
131
  paths: NavigationOutputPaths,
127
132
  artifacts: GeneratedNavigationArtifacts
128
133
  ): void {
129
- fs.writeFileSync(paths.turboModuleSpec, artifacts.turboModuleSpec);
134
+ writeFileEnsuringDir(paths.turboModuleSpec, artifacts.turboModuleSpec);
130
135
  logger.success(`Generated ${paths.turboModuleSpec}`);
131
136
 
132
- fs.writeFileSync(paths.navigationTs, artifacts.indexTs);
137
+ writeFileEnsuringDir(paths.navigationTs, artifacts.indexTs);
133
138
  logger.success(`Generated ${paths.navigationTs}`);
134
139
 
135
- fs.writeFileSync(paths.commonjsIndexJs, artifacts.indexJs);
140
+ writeFileEnsuringDir(paths.commonjsIndexJs, artifacts.indexJs);
136
141
  logger.success(`Generated ${paths.commonjsIndexJs}`);
137
142
 
138
- fs.writeFileSync(paths.moduleIndexJs, artifacts.indexJs);
143
+ writeFileEnsuringDir(paths.moduleIndexJs, artifacts.indexJs);
139
144
  logger.success(`Generated ${paths.moduleIndexJs}`);
140
145
 
141
- fs.writeFileSync(paths.commonjsIndexDts, artifacts.indexDts);
146
+ writeFileEnsuringDir(paths.commonjsIndexDts, artifacts.indexDts);
142
147
  logger.success(`Generated ${paths.commonjsIndexDts}`);
143
148
 
144
- fs.writeFileSync(paths.moduleIndexDts, artifacts.indexDts);
149
+ writeFileEnsuringDir(paths.moduleIndexDts, artifacts.indexDts);
145
150
  logger.success(`Generated ${paths.moduleIndexDts}`);
146
151
 
147
- fs.writeFileSync(paths.swiftDelegate, artifacts.swiftDelegate);
152
+ writeFileEnsuringDir(paths.swiftDelegate, artifacts.swiftDelegate);
148
153
  logger.success(`Generated ${paths.swiftDelegate}`);
149
154
 
150
155
  if (artifacts.swiftModels) {
151
- fs.writeFileSync(paths.swiftModels, artifacts.swiftModels);
156
+ writeFileEnsuringDir(paths.swiftModels, artifacts.swiftModels);
152
157
  logger.success(`Generated ${paths.swiftModels}`);
153
158
  }
154
159
 
155
- fs.writeFileSync(paths.objcImplementation, artifacts.objcImplementation);
160
+ writeFileEnsuringDir(paths.objcImplementation, artifacts.objcImplementation);
156
161
  logger.success(`Generated ${paths.objcImplementation}`);
157
162
 
158
- fs.writeFileSync(paths.kotlinDelegate, artifacts.kotlinDelegate);
163
+ writeFileEnsuringDir(paths.kotlinDelegate, artifacts.kotlinDelegate);
159
164
  logger.success(`Generated ${paths.kotlinDelegate}`);
160
165
 
161
- fs.writeFileSync(paths.kotlinModule, artifacts.kotlinModule);
166
+ writeFileEnsuringDir(paths.kotlinModule, artifacts.kotlinModule);
162
167
  logger.success(`Generated ${paths.kotlinModule}`);
163
168
 
164
169
  if (artifacts.kotlinModels) {
165
- fs.writeFileSync(paths.kotlinModels, artifacts.kotlinModels);
170
+ writeFileEnsuringDir(paths.kotlinModels, artifacts.kotlinModels);
166
171
  logger.success(`Generated ${paths.kotlinModels}`);
167
172
  }
168
173
  }
@@ -23,8 +23,10 @@ export function curryOptions(programCommand: Command, options: RockCLIOptions) {
23
23
  return programCommand;
24
24
  }
25
25
 
26
- export function actionRunner<T, R>(fn: (...args: T[]) => Promise<R>) {
27
- return async function wrappedCLIAction(...args: T[]) {
26
+ export function actionRunner<Args extends unknown[], R>(
27
+ fn: (...args: Args) => Promise<R>
28
+ ) {
29
+ return async function wrappedCLIAction(...args: Args) {
28
30
  try {
29
31
  await fn(...args);
30
32
  } catch (error) {
package/src/types.ts ADDED
@@ -0,0 +1,51 @@
1
+ import type {
2
+ PublishLocalAarFlags,
3
+ PackageAarFlags,
4
+ } from '@rock-js/platform-android';
5
+ import type { BuildFlags as AppleBuildFlags } from '@rock-js/platform-apple-helpers';
6
+
7
+ export type Platform = 'swift' | 'kotlin';
8
+
9
+ export type BrownfieldCommonOptions = Partial<{
10
+ verbose: boolean;
11
+ }>;
12
+
13
+ export type BrownfieldConfigMetadata = Partial<{
14
+ $schema: string;
15
+ }>;
16
+
17
+ export type BrownieConfig = {
18
+ kotlin?: string;
19
+ kotlinPackageName?: string;
20
+ };
21
+
22
+ export type PackageIosOptions = AppleBuildFlags & {
23
+ /** Set when `--use-prebuilt-rn-core` is passed; omitted when the flag is absent (Rock applies RN version defaults). */
24
+ usePrebuiltRnCore?: boolean;
25
+ /** When set, generate a local Swift Package Manager manifest next to the packaged XCFramework outputs. */
26
+ addSpmPackage?: boolean;
27
+ };
28
+
29
+ export type BrownfieldPackageAndroidOptions = BrownfieldCommonOptions &
30
+ Partial<PackageAarFlags>;
31
+ export type BrownfieldPublishAndroidOptions = BrownfieldCommonOptions &
32
+ Partial<PublishLocalAarFlags>;
33
+ export type BrownfieldPackageIosOptions = BrownfieldCommonOptions &
34
+ Partial<PackageIosOptions>;
35
+
36
+ export type BrownfieldAndroidConfig = Omit<
37
+ Partial<PackageAarFlags> & Partial<PublishLocalAarFlags>,
38
+ keyof BrownfieldCommonOptions
39
+ >;
40
+ export type BrownfieldIosConfig = Omit<
41
+ Partial<PackageIosOptions>,
42
+ keyof BrownfieldCommonOptions
43
+ >;
44
+
45
+ export type BrownfieldConfig = BrownfieldConfigMetadata &
46
+ BrownfieldCommonOptions &
47
+ Partial<{
48
+ android: BrownfieldAndroidConfig;
49
+ ios: BrownfieldIosConfig;
50
+ brownie: BrownieConfig;
51
+ }>;
@@ -1,2 +0,0 @@
1
- export type Platform = 'swift' | 'kotlin';
2
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/brownie/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC"}
@@ -1 +0,0 @@
1
- export type Platform = 'swift' | 'kotlin';
File without changes