Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Remove Prompt from CLI for switching to new arch.",
"packageName": "@react-native-windows/cli",
"email": "54227869+anupriya13@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
import {copyAndReplaceWithChangedCallback} from '../../generator-common';
import * as nameHelpers from '../../utils/nameHelpers';
import {showOldArchitectureWarning} from '../../utils/oldArchWarning';
import {promptForArchitectureChoice} from '../../utils/architecturePrompt';
import type {InitOptions} from './initWindowsOptions';
import {initOptions} from './initWindowsOptions';

Expand Down Expand Up @@ -156,9 +155,6 @@ export class InitWindows {
return;
}

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

const isOldArchTemplate = this.options.template.startsWith('old');
const promptFlag = this.options.prompt;

if (isOldArchTemplate) {
showOldArchitectureWarning();

if (userDidNotPassTemplate && promptFlag) {
const promptResult = await promptForArchitectureChoice();

if (
!promptResult.shouldContinueWithOldArch &&
!promptResult.userCancelled
) {
spinner.info('Switching to New Architecture template (cpp-app)...');
this.options.template = 'cpp-app';
}
}
}

const templateConfig = this.templates.get(this.options.template)!;
Expand Down Expand Up @@ -321,7 +304,6 @@ function optionSanitizer(key: keyof InitOptions, value: any): any {
case 'overwrite':
case 'telemetry':
case 'list':
case 'prompt':
return value === undefined ? false : value; // Return value
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export interface InitOptions {
overwrite?: boolean;
telemetry?: boolean;
list?: boolean;
prompt?: boolean;
}

export const initOptions: CommandOption[] = [
Expand Down Expand Up @@ -53,8 +52,4 @@ export const initOptions: CommandOption[] = [
description:
'Shows a list with all available templates with their descriptions.',
},
{
name: '--no-prompt',
description: 'Skip any interactive prompts and use default choices.',
},
];

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function validateOptionName(
case 'overwrite':
case 'telemetry':
case 'list':
case 'prompt':
return true;
}
throw new Error(
Expand Down Expand Up @@ -56,7 +55,6 @@ test('initOptions - validate options', () => {

// Validate all command options are present in InitOptions
const optionName = commanderNameToOptionName(commandOption.name);

expect(
validateOptionName(commandOption.name, optionName as keyof InitOptions),
).toBe(true);
Expand Down

This file was deleted.

12 changes: 12 additions & 0 deletions packages/@react-native-windows/cli/src/utils/oldArchWarning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,16 @@ export function showOldArchitectureWarning(): void {
),
);
console.log();
console.log(
chalk.blue(
'🔗 View the list of properties not yet supported in Fabric: https://microsoft.github.io/react-native-windows/docs/new-arch-missingProps',
),
);
console.log();
console.log(
chalk.blue(
'💬 If you encounter missing properties, please open an issue: https://github.com/microsoft/react-native-windows/issues',
),
);
console.log();
}
Loading