@callstack/brownfield-cli 3.3.0 → 3.5.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.
- package/CHANGELOG.md +18 -0
- package/dist/brownfield/commands/packageIos.js +1 -1
- package/dist/brownie/commands/codegen.js +4 -4
- package/dist/navigation/runner.d.ts.map +1 -1
- package/dist/navigation/runner.js +5 -2
- package/package.json +13 -13
- package/src/brownfield/commands/packageIos.ts +1 -1
- package/src/brownie/commands/codegen.ts +5 -5
- package/src/navigation/runner.ts +24 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @callstack/brownfield-cli
|
|
2
2
|
|
|
3
|
+
## 3.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#257](https://github.com/callstack/react-native-brownfield/pull/257) [`d0e6203`](https://github.com/callstack/react-native-brownfield/commit/d0e62039c8a080c648abbbeace047e72fadce28b) Thanks [@hurali97](https://github.com/hurali97)! - add brownie android
|
|
8
|
+
|
|
9
|
+
## 3.4.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#246](https://github.com/callstack/react-native-brownfield/pull/246) [`5484065`](https://github.com/callstack/react-native-brownfield/commit/5484065da9dc86a420af2be692fcdefa32fbb2af) Thanks [@artus9033](https://github.com/artus9033)! - chore: upgrade dependencies
|
|
14
|
+
|
|
15
|
+
- [#275](https://github.com/callstack/react-native-brownfield/pull/275) [`dd8b8a0`](https://github.com/callstack/react-native-brownfield/commit/dd8b8a0b532fe779c1f2ce018577ad748b887ee0) Thanks [@artus9033](https://github.com/artus9033)! - chore: bump up Gradle plugin version
|
|
16
|
+
|
|
17
|
+
- [#271](https://github.com/callstack/react-native-brownfield/pull/271) [`54ab7ab`](https://github.com/callstack/react-native-brownfield/commit/54ab7ab01bd6f95439cc8b702d4124552e22ad55) Thanks [@artus9033](https://github.com/artus9033)! - feat: improved logging in brownfield CLI codegens
|
|
18
|
+
|
|
19
|
+
- [#246](https://github.com/callstack/react-native-brownfield/pull/246) [`5484065`](https://github.com/callstack/react-native-brownfield/commit/5484065da9dc86a420af2be692fcdefa32fbb2af) Thanks [@artus9033](https://github.com/artus9033)! - chore: upgrade dependencies
|
|
20
|
+
|
|
3
21
|
## 3.3.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -64,7 +64,7 @@ export const packageIosCommand = curryOptions(new Command('package:ios').descrip
|
|
|
64
64
|
],
|
|
65
65
|
outputPath: brownieOutputPath,
|
|
66
66
|
});
|
|
67
|
-
// Strip the binary from
|
|
67
|
+
// Strip the binary from Brownie.xcframework to make it interface-only.
|
|
68
68
|
// This avoids duplicate symbols when consumer apps embed both BrownfieldLib
|
|
69
69
|
// (which contains Brownie symbols) and Brownie.xcframework.
|
|
70
70
|
stripFrameworkBinary(brownieOutputPath);
|
|
@@ -85,8 +85,8 @@ export async function runCodegen({ platform }) {
|
|
|
85
85
|
platforms = [platform];
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
|
-
//
|
|
89
|
-
platforms = ['swift'];
|
|
88
|
+
// Generate both Swift and Kotlin by default
|
|
89
|
+
platforms = ['swift', 'kotlin'];
|
|
90
90
|
}
|
|
91
91
|
await generateForStore(store, config, platforms, isMultipleStores);
|
|
92
92
|
}
|
|
@@ -101,11 +101,11 @@ export async function runCodegen({ platform }) {
|
|
|
101
101
|
throw error;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
outro('
|
|
104
|
+
outro('Brownie codegen done');
|
|
105
105
|
}
|
|
106
106
|
export const codegenCommand = new Command('codegen')
|
|
107
107
|
.description('Generate native store types from TypeScript schema')
|
|
108
|
-
.addOption(new Option('-p, --platform <platform>', 'Generate for specific platform (swift)').choices(['swift']))
|
|
108
|
+
.addOption(new Option('-p, --platform <platform>', 'Generate for specific platform (swift|kotlin)').choices(['swift', 'kotlin']))
|
|
109
109
|
.action(actionRunner(async (options) => {
|
|
110
110
|
await runCodegen(options);
|
|
111
111
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/navigation/runner.ts"],"names":[],"mappings":"AA2BA,UAAU,2BAA2B;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../src/navigation/runner.ts"],"names":[],"mappings":"AA2BA,UAAU,2BAA2B;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgLD,wBAAsB,oBAAoB,CAAC,EACzC,QAAQ,EACR,MAAc,EACd,WAA2B,GAC5B,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CA8D7C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { logger } from '@rock-js/tools';
|
|
3
|
+
import { intro, logger, outro } from '@rock-js/tools';
|
|
4
4
|
import { DEFAULT_ANDROID_JAVA_PACKAGE, getNavigationPackagePath, } from './config.js';
|
|
5
5
|
import { parseNavigationSpec } from './parser.js';
|
|
6
6
|
import { resolveNavigationSpecPath } from './spec-discovery.js';
|
|
@@ -86,12 +86,13 @@ export async function runNavigationCodegen({ specPath, dryRun = false, projectRo
|
|
|
86
86
|
if (!fs.existsSync(resolvedSpecPath)) {
|
|
87
87
|
throw new Error(`Spec file not found: ${resolvedSpecPath}`);
|
|
88
88
|
}
|
|
89
|
+
intro(`Running Brownfield Navigation codegen`);
|
|
89
90
|
logger.info(`Parsing spec file: ${resolvedSpecPath}`);
|
|
90
91
|
const methods = parseNavigationSpec(resolvedSpecPath);
|
|
91
92
|
if (methods.length === 0) {
|
|
92
93
|
throw new Error('No methods found in spec file');
|
|
93
94
|
}
|
|
94
|
-
logger.info(`Found ${methods.length} method
|
|
95
|
+
logger.info(`Found ${methods.length} method${methods.length === 1 ? '' : 's'}: ${methods.map((method) => method.name).join(', ')}`);
|
|
95
96
|
const packageRoot = getNavigationPackagePath(projectRoot);
|
|
96
97
|
const androidJavaPackageName = DEFAULT_ANDROID_JAVA_PACKAGE;
|
|
97
98
|
const indexTs = generateIndexTs(methods);
|
|
@@ -120,7 +121,9 @@ export async function runNavigationCodegen({ specPath, dryRun = false, projectRo
|
|
|
120
121
|
}
|
|
121
122
|
if (dryRun) {
|
|
122
123
|
printDryRun(androidJavaPackageName, artifacts);
|
|
124
|
+
outro('Brownfield Navigation codegen done');
|
|
123
125
|
return;
|
|
124
126
|
}
|
|
125
127
|
writeArtifacts(getOutputPaths(packageRoot, androidJavaPackageName), artifacts);
|
|
128
|
+
outro('Brownfield Navigation codegen done');
|
|
126
129
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@callstack/brownfield-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Artur Morys-Magiera <artus9033@gmail.com>",
|
|
6
6
|
"bin": {
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
"@expo/config": "^12.0.13",
|
|
76
76
|
"@react-native-community/cli-config": "^20.0.0",
|
|
77
77
|
"@react-native-community/cli-config-android": "^20.0.0",
|
|
78
|
-
"@rock-js/platform-android": "^0.12.
|
|
79
|
-
"@rock-js/platform-apple-helpers": "^0.12.
|
|
80
|
-
"@rock-js/plugin-brownfield-android": "^0.12.
|
|
81
|
-
"@rock-js/plugin-brownfield-ios": "^0.12.
|
|
82
|
-
"@rock-js/tools": "^0.12.
|
|
83
|
-
"commander": "^14.0.
|
|
78
|
+
"@rock-js/platform-android": "^0.12.12",
|
|
79
|
+
"@rock-js/platform-apple-helpers": "^0.12.12",
|
|
80
|
+
"@rock-js/plugin-brownfield-android": "^0.12.12",
|
|
81
|
+
"@rock-js/plugin-brownfield-ios": "^0.12.12",
|
|
82
|
+
"@rock-js/tools": "^0.12.12",
|
|
83
|
+
"commander": "^14.0.3",
|
|
84
84
|
"quicktype-core": "^23.2.6",
|
|
85
85
|
"quicktype-typescript-input": "^23.2.6",
|
|
86
86
|
"ts-morph": "^27.0.2"
|
|
@@ -94,13 +94,13 @@
|
|
|
94
94
|
"@react-native/eslint-config": "0.82.1",
|
|
95
95
|
"@types/babel__core": "^7.20.5",
|
|
96
96
|
"@types/babel__preset-env": "^7.10.0",
|
|
97
|
-
"@types/node": "^25.0
|
|
98
|
-
"@vitest/coverage-v8": "^4.0
|
|
99
|
-
"eslint": "^9.
|
|
100
|
-
"globals": "^
|
|
101
|
-
"nodemon": "^3.1.
|
|
97
|
+
"@types/node": "^25.5.0",
|
|
98
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
99
|
+
"eslint": "^9.39.3",
|
|
100
|
+
"globals": "^17.3.0",
|
|
101
|
+
"nodemon": "^3.1.14",
|
|
102
102
|
"typescript": "5.9.3",
|
|
103
|
-
"vitest": "^4.0
|
|
103
|
+
"vitest": "^4.1.0"
|
|
104
104
|
},
|
|
105
105
|
"engines": {
|
|
106
106
|
"node": ">=20"
|
|
@@ -118,7 +118,7 @@ export const packageIosCommand = curryOptions(
|
|
|
118
118
|
outputPath: brownieOutputPath,
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
// Strip the binary from
|
|
121
|
+
// Strip the binary from Brownie.xcframework to make it interface-only.
|
|
122
122
|
// This avoids duplicate symbols when consumer apps embed both BrownfieldLib
|
|
123
123
|
// (which contains Brownie symbols) and Brownie.xcframework.
|
|
124
124
|
stripFrameworkBinary(brownieOutputPath);
|
|
@@ -118,8 +118,8 @@ export async function runCodegen({ platform }: RunCodegenOptions) {
|
|
|
118
118
|
if (platform) {
|
|
119
119
|
platforms = [platform];
|
|
120
120
|
} else {
|
|
121
|
-
//
|
|
122
|
-
platforms = ['swift'];
|
|
121
|
+
// Generate both Swift and Kotlin by default
|
|
122
|
+
platforms = ['swift', 'kotlin'];
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
await generateForStore(store, config, platforms, isMultipleStores);
|
|
@@ -134,7 +134,7 @@ export async function runCodegen({ platform }: RunCodegenOptions) {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
outro('
|
|
137
|
+
outro('Brownie codegen done');
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
export const codegenCommand = new Command('codegen')
|
|
@@ -142,8 +142,8 @@ export const codegenCommand = new Command('codegen')
|
|
|
142
142
|
.addOption(
|
|
143
143
|
new Option(
|
|
144
144
|
'-p, --platform <platform>',
|
|
145
|
-
'Generate for specific platform (swift)'
|
|
146
|
-
).choices(['swift'])
|
|
145
|
+
'Generate for specific platform (swift|kotlin)'
|
|
146
|
+
).choices(['swift', 'kotlin'])
|
|
147
147
|
)
|
|
148
148
|
.action(
|
|
149
149
|
actionRunner(async (options: RunCodegenOptions) => {
|
package/src/navigation/runner.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import { logger } from '@rock-js/tools';
|
|
4
|
+
import { intro, logger, outro } from '@rock-js/tools';
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_ANDROID_JAVA_PACKAGE,
|
|
7
7
|
getNavigationPackagePath,
|
|
@@ -53,7 +53,11 @@ function getOutputPaths(
|
|
|
53
53
|
const androidPackagePathSegments = androidJavaPackageName.split('.');
|
|
54
54
|
|
|
55
55
|
return {
|
|
56
|
-
turboModuleSpec: path.join(
|
|
56
|
+
turboModuleSpec: path.join(
|
|
57
|
+
packageRoot,
|
|
58
|
+
'src',
|
|
59
|
+
'NativeBrownfieldNavigation.ts'
|
|
60
|
+
),
|
|
57
61
|
navigationTs: path.join(packageRoot, 'src', 'index.ts'),
|
|
58
62
|
commonjsIndexJs: path.join(packageRoot, 'lib', 'commonjs', 'index.js'),
|
|
59
63
|
moduleIndexJs: path.join(packageRoot, 'lib', 'module', 'index.js'),
|
|
@@ -78,7 +82,11 @@ function getOutputPaths(
|
|
|
78
82
|
'ios',
|
|
79
83
|
'BrownfieldNavigationDelegate.swift'
|
|
80
84
|
),
|
|
81
|
-
swiftModels: path.join(
|
|
85
|
+
swiftModels: path.join(
|
|
86
|
+
packageRoot,
|
|
87
|
+
'ios',
|
|
88
|
+
'BrownfieldNavigationModels.swift'
|
|
89
|
+
),
|
|
82
90
|
objcImplementation: path.join(
|
|
83
91
|
packageRoot,
|
|
84
92
|
'ios',
|
|
@@ -207,6 +215,8 @@ export async function runNavigationCodegen({
|
|
|
207
215
|
throw new Error(`Spec file not found: ${resolvedSpecPath}`);
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
intro(`Running Brownfield Navigation codegen`);
|
|
219
|
+
|
|
210
220
|
logger.info(`Parsing spec file: ${resolvedSpecPath}`);
|
|
211
221
|
const methods = parseNavigationSpec(resolvedSpecPath);
|
|
212
222
|
if (methods.length === 0) {
|
|
@@ -214,7 +224,7 @@ export async function runNavigationCodegen({
|
|
|
214
224
|
}
|
|
215
225
|
|
|
216
226
|
logger.info(
|
|
217
|
-
`Found ${methods.length} method
|
|
227
|
+
`Found ${methods.length} method${methods.length === 1 ? '' : 's'}: ${methods.map((method) => method.name).join(', ')}`
|
|
218
228
|
);
|
|
219
229
|
|
|
220
230
|
const packageRoot = getNavigationPackagePath(projectRoot);
|
|
@@ -244,13 +254,21 @@ export async function runNavigationCodegen({
|
|
|
244
254
|
artifacts.swiftModels = models.swiftModels;
|
|
245
255
|
artifacts.kotlinModels = models.kotlinModels;
|
|
246
256
|
} else {
|
|
247
|
-
logger.info(
|
|
257
|
+
logger.info(
|
|
258
|
+
'No complex model types found; skipping quicktype model generation'
|
|
259
|
+
);
|
|
248
260
|
}
|
|
249
261
|
|
|
250
262
|
if (dryRun) {
|
|
251
263
|
printDryRun(androidJavaPackageName, artifacts);
|
|
264
|
+
outro('Brownfield Navigation codegen done');
|
|
252
265
|
return;
|
|
253
266
|
}
|
|
254
267
|
|
|
255
|
-
writeArtifacts(
|
|
268
|
+
writeArtifacts(
|
|
269
|
+
getOutputPaths(packageRoot, androidJavaPackageName),
|
|
270
|
+
artifacts
|
|
271
|
+
);
|
|
272
|
+
|
|
273
|
+
outro('Brownfield Navigation codegen done');
|
|
256
274
|
}
|