Skip to content

Commit 44a57fa

Browse files
Copilotanupriya13
andcommitted
Fix module-windows-setup to use correct package root instead of example directory
Co-authored-by: anupriya13 <54227869+anupriya13@users.noreply.github.com>
1 parent 60d02d6 commit 44a57fa

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,14 @@ export default TurboModuleRegistry.getEnforcing<Spec>('${moduleName}');
689689
this.verboseMessage('Running init-windows with cpp-lib template...');
690690

691691
try {
692-
await initWindowsInternal([], config, {
692+
// Create a modified config with the correct root directory
693+
// The original config might point to an example directory instead of the package root
694+
const modifiedConfig: Config = {
695+
...config,
696+
root: this.root, // Use our validated package root instead of config.root
697+
};
698+
699+
await initWindowsInternal([], modifiedConfig, {
693700
template: 'cpp-lib',
694701
overwrite: true,
695702
logging: this.options.logging,
@@ -716,7 +723,14 @@ export default TurboModuleRegistry.getEnforcing<Spec>('${moduleName}');
716723
this.verboseMessage('Running codegen-windows...');
717724

718725
try {
719-
await codegenWindowsInternal([], config, {
726+
// Create a modified config with the correct root directory
727+
// The original config might point to an example directory instead of the package root
728+
const modifiedConfig: Config = {
729+
...config,
730+
root: this.root, // Use our validated package root instead of config.root
731+
};
732+
733+
await codegenWindowsInternal([], modifiedConfig, {
720734
logging: this.options.logging,
721735
telemetry: this.options.telemetry,
722736
});

0 commit comments

Comments
 (0)