@@ -183,6 +183,11 @@ export async function generateComposerUpdates(updates: Array<{ name: string, new
183
183
const fileUpdates : Array < { path : string , content : string , type : 'update' } > = [ ]
184
184
const composerUpdates = updates . filter ( update => update . file . endsWith ( 'composer.json' ) )
185
185
186
+ console . log ( `🐛 COMPOSER PARSER DEBUG: Received ${ updates . length } total updates, ${ composerUpdates . length } composer updates` )
187
+ composerUpdates . forEach ( update => {
188
+ console . log ( `🐛 - Processing: ${ update . name } -> ${ update . newVersion } ` )
189
+ } )
190
+
186
191
if ( composerUpdates . length === 0 ) {
187
192
return fileUpdates
188
193
}
@@ -200,23 +205,31 @@ export async function generateComposerUpdates(updates: Array<{ name: string, new
200
205
} )
201
206
}
202
207
208
+ console . log ( `🐛 COMPOSER PARSER DEBUG: Processing ${ updatesByFile . size } file(s)` )
209
+
203
210
// Process each composer.json file
204
211
for ( const [ filePath , fileUpdates_ ] of updatesByFile ) {
205
212
try {
213
+ console . log ( `🐛 COMPOSER PARSER DEBUG: Processing file ${ filePath } with ${ fileUpdates_ . length } updates` )
214
+
206
215
// Read current composer.json content
207
216
const fs = await import ( 'node:fs' )
208
217
let composerContent = fs . readFileSync ( filePath , 'utf-8' )
209
218
219
+ console . log ( `🐛 COMPOSER PARSER DEBUG: Original composer.json content length: ${ composerContent . length } ` )
220
+
210
221
// Parse to understand structure
211
222
const composerData : ComposerPackage = JSON . parse ( composerContent )
212
223
213
224
// Apply updates using string replacement to preserve formatting
214
225
for ( const update of fileUpdates_ ) {
226
+ console . log ( `🐛 COMPOSER PARSER DEBUG: Applying update for ${ update . name } -> ${ update . newVersion } ` )
215
227
let packageFound = false
216
228
217
229
// Check in require section
218
230
if ( composerData . require && composerData . require [ update . name ] ) {
219
231
const currentVersionInFile = composerData . require [ update . name ]
232
+ console . log ( `🐛 Found ${ update . name } in require: ${ currentVersionInFile } ` )
220
233
221
234
// For complex constraints like ">=6.0,<7.0", preserve the constraint format
222
235
// and just update the version numbers
@@ -235,6 +248,8 @@ export async function generateComposerUpdates(updates: Array<{ name: string, new
235
248
newVersion = `${ originalPrefix } ${ update . newVersion } `
236
249
}
237
250
251
+ console . log ( `🐛 Updating ${ update . name } : ${ currentVersionInFile } -> ${ newVersion } ` )
252
+
238
253
// Create regex to find the exact line with this package and version
239
254
const packageRegex = new RegExp (
240
255
`("${ update . name . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) } "\\s*:\\s*")([^"]+)(")` ,
@@ -248,6 +263,7 @@ export async function generateComposerUpdates(updates: Array<{ name: string, new
248
263
// Check in require-dev section
249
264
if ( ! packageFound && composerData [ 'require-dev' ] && composerData [ 'require-dev' ] [ update . name ] ) {
250
265
const currentVersionInFile = composerData [ 'require-dev' ] [ update . name ]
266
+ console . log ( `🐛 Found ${ update . name } in require-dev: ${ currentVersionInFile } ` )
251
267
252
268
// For complex constraints like ">=6.0,<7.0", preserve the constraint format
253
269
// and just update the version numbers
@@ -266,6 +282,8 @@ export async function generateComposerUpdates(updates: Array<{ name: string, new
266
282
newVersion = `${ originalPrefix } ${ update . newVersion } `
267
283
}
268
284
285
+ console . log ( `🐛 Updating ${ update . name } : ${ currentVersionInFile } -> ${ newVersion } ` )
286
+
269
287
const packageRegex = new RegExp (
270
288
`("${ update . name . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) } "\\s*:\\s*")([^"]+)(")` ,
271
289
'g' ,
@@ -280,6 +298,8 @@ export async function generateComposerUpdates(updates: Array<{ name: string, new
280
298
}
281
299
}
282
300
301
+ console . log ( `🐛 COMPOSER PARSER DEBUG: Final composer.json content length: ${ composerContent . length } ` )
302
+
283
303
fileUpdates . push ( {
284
304
path : filePath ,
285
305
content : composerContent ,
@@ -291,5 +311,6 @@ export async function generateComposerUpdates(updates: Array<{ name: string, new
291
311
}
292
312
}
293
313
314
+ console . log ( `🐛 COMPOSER PARSER DEBUG: Returning ${ fileUpdates . length } file updates` )
294
315
return fileUpdates
295
316
}
0 commit comments