@@ -93,6 +93,24 @@ async function getFileMappings(config = {}, options = {}) {
93
93
. replace ( '}' , '' ) ?? crypto . randomUUID ( ) ;
94
94
const currentUser = username . sync ( ) ; // Gets the current username depending on the platform.
95
95
96
+ // Check for existing codegen spec files
97
+ const codegenPath = path . join ( projectRoot , 'windows' , projectName , 'codegen' ) ;
98
+ let existingSpecFiles = [ ] ;
99
+ let firstSpecName = null ;
100
+ if ( existsSync ( codegenPath ) ) {
101
+ try {
102
+ const specFiles = await glob ( '*Spec.g.h' , { cwd : codegenPath } ) ;
103
+ existingSpecFiles = specFiles ;
104
+ if ( specFiles . length > 0 ) {
105
+ // Extract the spec name from filename (e.g., "NativeMyModuleSpec.g.h" -> "MyModuleSpec")
106
+ const firstFile = specFiles [ 0 ] ;
107
+ firstSpecName = firstFile . replace ( / ^ N a t i v e / , '' ) . replace ( / \. g \. h $ / , '' ) ;
108
+ }
109
+ } catch ( e ) {
110
+ // If we can't read the codegen directory, continue with empty array
111
+ }
112
+ }
113
+
96
114
const cppNugetPackages = [ ] ;
97
115
98
116
const replacements = {
@@ -104,6 +122,12 @@ async function getFileMappings(config = {}, options = {}) {
104
122
namespace : namespace ,
105
123
namespaceCpp : namespaceCpp ,
106
124
125
+ // Codegen spec files information
126
+ existingSpecFiles : existingSpecFiles ,
127
+ hasExistingSpecFiles : existingSpecFiles . length > 0 ,
128
+ firstSpecFile : existingSpecFiles . length > 0 ? existingSpecFiles [ 0 ] : null ,
129
+ firstSpecName : firstSpecName ,
130
+
107
131
rnwVersion : rnwVersion ,
108
132
rnwPathFromProjectRoot : path
109
133
. relative ( projectRoot , rnwPath )
0 commit comments