1
- /* eslint-disable no-console */
2
1
import type { DashboardData , PackageFile , PullRequest } from '../types'
3
2
4
3
export class DashboardGenerator {
@@ -254,14 +253,6 @@ The following updates have all been created. To force a retry/rebase of any, cli
254
253
private extractPackageInfo ( pr : PullRequest ) : string [ ] {
255
254
const packages : string [ ] = [ ]
256
255
257
- // Add logging for debugging the real issue
258
- const isTargetPR = pr . title . includes ( 'update all non-major dependencies' )
259
- if ( isTargetPR ) {
260
- console . log ( `\n🔍 DEBUG: Extracting from PR #${ pr . number } ` )
261
- console . log ( `📝 Title: "${ pr . title } "` )
262
- console . log ( `📄 Body preview: "${ pr . body . substring ( 0 , 200 ) } ..."\n` )
263
- }
264
-
265
256
// Pattern 1: Extract from common dependency update titles
266
257
// Examples: "chore(deps): update dependency react to v18"
267
258
// "chore(deps): update all non-major dependencies"
@@ -276,8 +267,6 @@ The following updates have all been created. To force a retry/rebase of any, cli
276
267
const match = pr . title . match ( pattern )
277
268
if ( match && match [ 1 ] && ! packages . includes ( match [ 1 ] ) ) {
278
269
packages . push ( match [ 1 ] )
279
- if ( isTargetPR )
280
- console . log ( `✅ Title match: "${ match [ 1 ] } "` )
281
270
}
282
271
}
283
272
@@ -298,36 +287,22 @@ The following updates have all been created. To force a retry/rebase of any, cli
298
287
const sectionMatch = pr . body . match ( section . pattern )
299
288
if ( sectionMatch ) {
300
289
const sectionContent = sectionMatch [ 0 ]
301
- if ( isTargetPR )
302
- console . log ( `📊 Found ${ section . name } section` )
303
290
304
291
// Extract package names from this section's table
305
292
const tableRowMatches = sectionContent . match ( / \| \s * \[ ( [ ^ \] ] + ) \] \( [ ^ ) ] + \) \s * \| / g)
306
293
if ( tableRowMatches ) {
307
- if ( isTargetPR ) {
308
- console . log ( `📊 ${ section . name } table matches: ${ tableRowMatches . length } ` )
309
- console . log ( `📋 Raw ${ section . name } matches:` , JSON . stringify ( tableRowMatches ) )
310
- }
311
-
312
294
for ( const match of tableRowMatches ) {
313
295
const packageMatch = match . match ( / \| \s * \[ ( [ ^ \] ] + ) \] / )
314
296
if ( packageMatch && packageMatch [ 1 ] ) {
315
297
const packageName = packageMatch [ 1 ] . trim ( )
316
298
317
- if ( isTargetPR ) {
318
- console . log ( `🔍 Checking ${ section . name } : "${ packageName } "` )
319
- }
320
-
321
299
// Check if this looks like a version string - if so, try to extract package name from URL
322
300
if ( packageName . includes ( '`' ) && packageName . includes ( '->' ) ) {
323
301
// This is a version string like "`1.2.17` -> `1.2.19`"
324
302
// Try to extract the package name from the URL
325
303
const urlMatch = match . match ( / \] \( ( [ ^ ) ] + ) \) / )
326
304
if ( urlMatch && urlMatch [ 1 ] ) {
327
305
const url = urlMatch [ 1 ]
328
- if ( isTargetPR ) {
329
- console . log ( `🔗 Extracting from URL: "${ url } "` )
330
- }
331
306
332
307
// Extract package name from Renovate diff URLs like:
333
308
// https://renovatebot.com/diffs/npm/%40types%2Fbun/1.2.17/1.2.19
@@ -336,19 +311,11 @@ The following updates have all been created. To force a retry/rebase of any, cli
336
311
if ( diffUrlMatch && diffUrlMatch [ 1 ] ) {
337
312
// Decode URL encoding like %40types%2Fbun -> @types/bun
338
313
const extractedPackage = decodeURIComponent ( diffUrlMatch [ 1 ] )
339
- if ( isTargetPR ) {
340
- console . log ( `📦 Extracted from URL: "${ extractedPackage } "` )
341
- }
342
314
343
315
if ( extractedPackage && extractedPackage . length > 1 && ! packages . includes ( extractedPackage ) ) {
344
316
packages . push ( extractedPackage )
345
- if ( isTargetPR )
346
- console . log ( `✅ ${ section . name } (from URL): "${ extractedPackage } "` )
347
317
}
348
318
}
349
- else if ( isTargetPR ) {
350
- console . log ( `❌ Could not extract package from URL: "${ url } "` )
351
- }
352
319
}
353
320
continue // Skip the normal processing for version strings
354
321
}
@@ -369,26 +336,10 @@ The following updates have all been created. To force a retry/rebase of any, cli
369
336
&& packageName . length > 0
370
337
&& ! packages . includes ( packageName ) ) {
371
338
packages . push ( packageName )
372
- if ( isTargetPR )
373
- console . log ( `✅ ${ section . name } : "${ packageName } "` )
374
- }
375
- else if ( isTargetPR ) {
376
- console . log ( `❌ ${ section . name } skipped: "${ packageName } " (likely version string)` )
377
339
}
378
340
}
379
341
}
380
342
}
381
- else if ( isTargetPR ) {
382
- console . log ( `❌ No table matches in ${ section . name } section` )
383
- // Let's also try a simpler approach - look for table rows with package names
384
- const simpleRowMatches = sectionContent . match ( / ^ \| \s * \[ ( [ ^ \] ] + ) \] / gm)
385
- if ( simpleRowMatches ) {
386
- console . log ( `🔄 Trying simpler pattern, found ${ simpleRowMatches . length } rows:` , JSON . stringify ( simpleRowMatches ) )
387
- }
388
- }
389
- }
390
- else if ( isTargetPR ) {
391
- console . log ( `❌ No ${ section . name } section found` )
392
343
}
393
344
}
394
345
@@ -398,11 +349,6 @@ The following updates have all been created. To force a retry/rebase of any, cli
398
349
if ( packages . length < 3 ) { // Allow backtick extraction to supplement table extraction
399
350
const bodyMatches = pr . body . match ( / ` ( [ ^ ` ] + ) ` / g)
400
351
if ( bodyMatches ) {
401
- if ( isTargetPR ) {
402
- console . log ( `🔍 Backtick matches (${ bodyMatches . length } ):` )
403
- console . log ( JSON . stringify ( bodyMatches . slice ( 0 , 10 ) ) ) // Show first 10
404
- }
405
-
406
352
for ( const match of bodyMatches ) {
407
353
let packageName = match . replace ( / ` / g, '' ) . trim ( )
408
354
@@ -422,8 +368,6 @@ The following updates have all been created. To force a retry/rebase of any, cli
422
368
|| packageName . includes ( 'Compare Source' )
423
369
|| packageName . includes ( 'badge' )
424
370
|| packageName . includes ( ' ' ) ) { // Package names shouldn't have spaces
425
- if ( isTargetPR )
426
- console . log ( `❌ Skipped: "${ packageName } "` )
427
371
continue
428
372
}
429
373
@@ -441,26 +385,12 @@ The following updates have all been created. To force a retry/rebase of any, cli
441
385
|| packageName . match ( / ^ [ a - z ] [ a - z 0 - 9 . - ] * $ / i) // Simple package names like lodash, ts-pkgx, bun.com
442
386
) ) {
443
387
packages . push ( packageName )
444
- if ( isTargetPR )
445
- console . log ( `✅ Added: "${ packageName } "` )
446
- }
447
- else if ( isTargetPR ) {
448
- console . log ( `❌ Failed validation: "${ packageName } "` )
449
388
}
450
389
}
451
390
}
452
- else if ( isTargetPR ) {
453
- console . log ( `❌ No backtick matches found` )
454
- }
455
- }
456
- else if ( isTargetPR ) {
457
- console . log ( `⏭️ Skipping backticks (have ${ packages . length } packages)` )
458
391
}
459
392
460
393
// NO LIMIT - return all packages like Renovate does
461
- if ( isTargetPR ) {
462
- console . log ( `\n📋 FINAL RESULT: ${ JSON . stringify ( packages ) } (${ packages . length } packages)\n` )
463
- }
464
394
return packages
465
395
}
466
396
0 commit comments