Skip to content

Commit 089e83d

Browse files
committed
chore: wip
1 parent 6012d18 commit 089e83d

File tree

2 files changed

+7
-75
lines changed

2 files changed

+7
-75
lines changed

src/dashboard/dashboard-generator.ts

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import type { DashboardData, PackageFile, PullRequest } from '../types'
32

43
export class DashboardGenerator {
@@ -254,14 +253,6 @@ The following updates have all been created. To force a retry/rebase of any, cli
254253
private extractPackageInfo(pr: PullRequest): string[] {
255254
const packages: string[] = []
256255

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-
265256
// Pattern 1: Extract from common dependency update titles
266257
// Examples: "chore(deps): update dependency react to v18"
267258
// "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
276267
const match = pr.title.match(pattern)
277268
if (match && match[1] && !packages.includes(match[1])) {
278269
packages.push(match[1])
279-
if (isTargetPR)
280-
console.log(`✅ Title match: "${match[1]}"`)
281270
}
282271
}
283272

@@ -298,36 +287,22 @@ The following updates have all been created. To force a retry/rebase of any, cli
298287
const sectionMatch = pr.body.match(section.pattern)
299288
if (sectionMatch) {
300289
const sectionContent = sectionMatch[0]
301-
if (isTargetPR)
302-
console.log(`📊 Found ${section.name} section`)
303290

304291
// Extract package names from this section's table
305292
const tableRowMatches = sectionContent.match(/\|\s*\[([^\]]+)\]\([^)]+\)\s*\|/g)
306293
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-
312294
for (const match of tableRowMatches) {
313295
const packageMatch = match.match(/\|\s*\[([^\]]+)\]/)
314296
if (packageMatch && packageMatch[1]) {
315297
const packageName = packageMatch[1].trim()
316298

317-
if (isTargetPR) {
318-
console.log(`🔍 Checking ${section.name}: "${packageName}"`)
319-
}
320-
321299
// Check if this looks like a version string - if so, try to extract package name from URL
322300
if (packageName.includes('`') && packageName.includes('->')) {
323301
// This is a version string like "`1.2.17` -> `1.2.19`"
324302
// Try to extract the package name from the URL
325303
const urlMatch = match.match(/\]\(([^)]+)\)/)
326304
if (urlMatch && urlMatch[1]) {
327305
const url = urlMatch[1]
328-
if (isTargetPR) {
329-
console.log(`🔗 Extracting from URL: "${url}"`)
330-
}
331306

332307
// Extract package name from Renovate diff URLs like:
333308
// 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
336311
if (diffUrlMatch && diffUrlMatch[1]) {
337312
// Decode URL encoding like %40types%2Fbun -> @types/bun
338313
const extractedPackage = decodeURIComponent(diffUrlMatch[1])
339-
if (isTargetPR) {
340-
console.log(`📦 Extracted from URL: "${extractedPackage}"`)
341-
}
342314

343315
if (extractedPackage && extractedPackage.length > 1 && !packages.includes(extractedPackage)) {
344316
packages.push(extractedPackage)
345-
if (isTargetPR)
346-
console.log(`✅ ${section.name} (from URL): "${extractedPackage}"`)
347317
}
348318
}
349-
else if (isTargetPR) {
350-
console.log(`❌ Could not extract package from URL: "${url}"`)
351-
}
352319
}
353320
continue // Skip the normal processing for version strings
354321
}
@@ -369,26 +336,10 @@ The following updates have all been created. To force a retry/rebase of any, cli
369336
&& packageName.length > 0
370337
&& !packages.includes(packageName)) {
371338
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)`)
377339
}
378340
}
379341
}
380342
}
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`)
392343
}
393344
}
394345

@@ -398,11 +349,6 @@ The following updates have all been created. To force a retry/rebase of any, cli
398349
if (packages.length < 3) { // Allow backtick extraction to supplement table extraction
399350
const bodyMatches = pr.body.match(/`([^`]+)`/g)
400351
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-
406352
for (const match of bodyMatches) {
407353
let packageName = match.replace(/`/g, '').trim()
408354

@@ -422,8 +368,6 @@ The following updates have all been created. To force a retry/rebase of any, cli
422368
|| packageName.includes('Compare Source')
423369
|| packageName.includes('badge')
424370
|| packageName.includes(' ')) { // Package names shouldn't have spaces
425-
if (isTargetPR)
426-
console.log(`❌ Skipped: "${packageName}"`)
427371
continue
428372
}
429373

@@ -441,26 +385,12 @@ The following updates have all been created. To force a retry/rebase of any, cli
441385
|| packageName.match(/^[a-z][a-z0-9.-]*$/i) // Simple package names like lodash, ts-pkgx, bun.com
442386
)) {
443387
packages.push(packageName)
444-
if (isTargetPR)
445-
console.log(`✅ Added: "${packageName}"`)
446-
}
447-
else if (isTargetPR) {
448-
console.log(`❌ Failed validation: "${packageName}"`)
449388
}
450389
}
451390
}
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)`)
458391
}
459392

460393
// 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-
}
464394
return packages
465395
}
466396

test/dashboard-generator.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,17 @@ describe('DashboardGenerator', () => {
103103
104104
| Package | Change | Age | Adoption | Passing | Confidence |
105105
|---|---|---|---|---|---|
106-
| [@types/bun](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bun) | \`1.2.17\` -> \`1.2.19\` | [![age](badge)] | [![adoption](badge)] | [![passing](badge)] | [![confidence](badge)] |
107-
| [cac](https://github.com/egoist/cac) | \`6.7.13\` -> \`6.7.14\` | [![age](badge)] | [![adoption](badge)] | [![passing](badge)] | [![confidence](badge)] |
108-
| [ts-pkgx](https://github.com/stacksjs/ts-pkgx) | \`0.4.4\` -> \`0.4.7\` | [![age](badge)] | [![adoption](badge)] | [![passing](badge)] | [![confidence](badge)] |
106+
| [@types/bun](https://redirect.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bun) | [\`1.2.17\` -> \`1.2.19\`](https://renovatebot.com/diffs/npm/%40types%2Fbun/1.2.17/1.2.19) | [![age](badge)] | [![adoption](badge)] | [![passing](badge)] | [![confidence](badge)] |
107+
| [cac](https://github.com/egoist/cac) | [\`6.7.13\` -> \`6.7.14\`](https://renovatebot.com/diffs/npm/cac/6.7.13/6.7.14) | [![age](badge)] | [![adoption](badge)] | [![passing](badge)] | [![confidence](badge)] |
108+
| [ts-pkgx](https://github.com/stacksjs/ts-pkgx) | [\`0.4.4\` -> \`0.4.7\`](https://renovatebot.com/diffs/npm/ts-pkgx/0.4.4/0.4.7) | [![age](badge)] | [![adoption](badge)] | [![passing](badge)] | [![confidence](badge)] |
109109
110110
### GitHub Actions
111111
112112
| Action | Change | File | Status |
113113
|---|---|---|---|
114-
| [actions/checkout](https://github.com/actions/checkout) | \`v4\` -> \`v4.2.2\` | ci.yml | ✅ Available |`,
114+
| [actions/checkout](https://github.com/actions/checkout) | \`v4\` -> \`v4.2.2\` | ci.yml | ✅ Available |
115+
116+
---`,
115117
head: 'update-deps',
116118
base: 'main',
117119
state: 'open',
@@ -134,7 +136,7 @@ describe('DashboardGenerator', () => {
134136

135137
const result = generator.generateDashboard(dashboardData)
136138

137-
// Should extract package names from table format
139+
// Should extract package names from table format (npm packages from URLs + GitHub Actions)
138140
expect(result.body).toContain('(`@types/bun`, `cac`, `ts-pkgx`, `actions/checkout`')
139141
})
140142

0 commit comments

Comments
 (0)