Skip to content

Commit 9bc8710

Browse files
authored
Remove Prompt from CLI for switching to New Arch and update warning. (#15087) (#15102)
1 parent c3f9568 commit 9bc8710

File tree

7 files changed

+19
-176
lines changed

7 files changed

+19
-176
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Remove Prompt from CLI for switching to new arch.",
4+
"packageName": "@react-native-windows/cli",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/@react-native-windows/cli/src/commands/initWindows/initWindows.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
import {copyAndReplaceWithChangedCallback} from '../../generator-common';
3232
import * as nameHelpers from '../../utils/nameHelpers';
3333
import {showOldArchitectureWarning} from '../../utils/oldArchWarning';
34-
import {promptForArchitectureChoice} from '../../utils/architecturePrompt';
3534
import type {InitOptions} from './initWindowsOptions';
3635
import {initOptions} from './initWindowsOptions';
3736

@@ -156,9 +155,6 @@ export class InitWindows {
156155
return;
157156
}
158157

159-
const userDidNotPassTemplate = !process.argv.some(arg =>
160-
arg.startsWith('--template'),
161-
);
162158
this.options.template ??=
163159
(this.rnwConfig?.['init-windows']?.template as string | undefined) ??
164160
this.getDefaultTemplateName();
@@ -172,22 +168,9 @@ export class InitWindows {
172168
}
173169

174170
const isOldArchTemplate = this.options.template.startsWith('old');
175-
const promptFlag = this.options.prompt;
176171

177172
if (isOldArchTemplate) {
178173
showOldArchitectureWarning();
179-
180-
if (userDidNotPassTemplate && promptFlag) {
181-
const promptResult = await promptForArchitectureChoice();
182-
183-
if (
184-
!promptResult.shouldContinueWithOldArch &&
185-
!promptResult.userCancelled
186-
) {
187-
spinner.info('Switching to New Architecture template (cpp-app)...');
188-
this.options.template = 'cpp-app';
189-
}
190-
}
191174
}
192175

193176
const templateConfig = this.templates.get(this.options.template)!;
@@ -321,7 +304,6 @@ function optionSanitizer(key: keyof InitOptions, value: any): any {
321304
case 'overwrite':
322305
case 'telemetry':
323306
case 'list':
324-
case 'prompt':
325307
return value === undefined ? false : value; // Return value
326308
}
327309
}

packages/@react-native-windows/cli/src/commands/initWindows/initWindowsOptions.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export interface InitOptions {
1414
overwrite?: boolean;
1515
telemetry?: boolean;
1616
list?: boolean;
17-
prompt?: boolean;
1817
}
1918

2019
export const initOptions: CommandOption[] = [
@@ -53,8 +52,4 @@ export const initOptions: CommandOption[] = [
5352
description:
5453
'Shows a list with all available templates with their descriptions.',
5554
},
56-
{
57-
name: '--no-prompt',
58-
description: 'Skip any interactive prompts and use default choices.',
59-
},
6055
];

packages/@react-native-windows/cli/src/e2etest/architecturePrompt.test.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.

packages/@react-native-windows/cli/src/e2etest/initWindows.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ function validateOptionName(
2626
case 'overwrite':
2727
case 'telemetry':
2828
case 'list':
29-
case 'prompt':
3029
return true;
3130
}
3231
throw new Error(
@@ -56,7 +55,6 @@ test('initOptions - validate options', () => {
5655

5756
// Validate all command options are present in InitOptions
5857
const optionName = commanderNameToOptionName(commandOption.name);
59-
6058
expect(
6159
validateOptionName(commandOption.name, optionName as keyof InitOptions),
6260
).toBe(true);

packages/@react-native-windows/cli/src/utils/architecturePrompt.ts

Lines changed: 0 additions & 67 deletions
This file was deleted.

packages/@react-native-windows/cli/src/utils/oldArchWarning.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,16 @@ export function showOldArchitectureWarning(): void {
2828
),
2929
);
3030
console.log();
31+
console.log(
32+
chalk.blue(
33+
'🔗 View the list of properties not yet supported in Fabric: https://microsoft.github.io/react-native-windows/docs/new-arch-missingProps',
34+
),
35+
);
36+
console.log();
37+
console.log(
38+
chalk.blue(
39+
'💬 If you encounter missing properties, please open an issue: https://github.com/microsoft/react-native-windows/issues',
40+
),
41+
);
42+
console.log();
3143
}

0 commit comments

Comments
 (0)