Skip to content

Commit 5be4686

Browse files
committed
Pass --react-native-package-name into config when loading
1 parent a860077 commit 5be4686

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/cli-config/src/commands/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ export default {
2727
name: '--platform <platform>',
2828
description: 'Output configuration for a specific platform',
2929
},
30+
{
31+
name: '--react-native-package-name <platform>',
32+
description:
33+
'Optional package name to use when resolving react-native, passable by out-of-tree platforms.',
34+
},
3035
],
3136
func: async (_argv: string[], ctx: Config) => {
3237
console.log(JSON.stringify(filterConfig(ctx), null, 2));

packages/cli/src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ async function setupAndRun(platformName?: string) {
182182
let config: Config | undefined;
183183
try {
184184
let selectedPlatform: string | undefined;
185+
let reactNativePackageName: string | undefined;
185186

186187
/*
187188
When linking dependencies in iOS and Android build we're passing `--platform` argument,
@@ -193,10 +194,22 @@ async function setupAndRun(platformName?: string) {
193194
if (platformIndex !== -1 && platformIndex < process.argv.length - 1) {
194195
selectedPlatform = process.argv[platformIndex + 1];
195196
}
197+
198+
const reactNativePackageNameIndex = process.argv.indexOf(
199+
'--react-native-package-name',
200+
);
201+
202+
if (
203+
reactNativePackageNameIndex !== -1 &&
204+
reactNativePackageNameIndex < process.argv.length - 1
205+
) {
206+
reactNativePackageName = process.argv[reactNativePackageNameIndex + 1];
207+
}
196208
}
197209

198210
config = await loadConfigAsync({
199211
selectedPlatform,
212+
reactNativePackageName,
200213
});
201214

202215
logger.enable();

0 commit comments

Comments
 (0)