@@ -452,10 +452,10 @@ export class PullRequestGenerator {
452
452
: `https://pkgx.com/pkg/${ encodeURIComponent ( update . name ) } `
453
453
const packageCell = `[${ displayName } ](${ packageUrl } )`
454
454
455
- // Enhanced version change display with update type
455
+ // Enhanced version change display with update type and proper constraint format
456
456
const updateType = this . getUpdateType ( update . currentVersion , update . newVersion )
457
457
const typeEmoji = updateType === 'major' ? '🔴' : updateType === 'minor' ? '🟡' : '🟢'
458
- const change = `\` ${ update . currentVersion } \` → \` ${ update . newVersion } \``
458
+ const change = this . formatVersionChange ( update . currentVersion , update . newVersion )
459
459
460
460
// File reference with link to actual file
461
461
const fileName = update . file . split ( '/' ) . pop ( ) || update . file
@@ -491,10 +491,10 @@ export class PullRequestGenerator {
491
491
const actionUrl = `https://github.com/${ update . name } `
492
492
const actionCell = `[${ update . name } ](${ actionUrl } )`
493
493
494
- // Enhanced version change display with update type
494
+ // Enhanced version change display with update type and proper constraint format
495
495
const updateType = this . getUpdateType ( update . currentVersion , update . newVersion )
496
496
const typeEmoji = updateType === 'major' ? '🔴' : updateType === 'minor' ? '🟡' : '🟢'
497
- const change = `\` ${ update . currentVersion } \` → \` ${ update . newVersion } \``
497
+ const change = this . formatVersionChange ( update . currentVersion , update . newVersion )
498
498
499
499
// Enhanced file reference with proper GitHub links
500
500
const fileLinks = update . file . includes ( ', ' )
@@ -619,7 +619,11 @@ export class PullRequestGenerator {
619
619
620
620
body += `<details>\n`
621
621
body += `<summary>${ displayName } </summary>\n\n`
622
- body += `**${ update . currentVersion } -> ${ update . newVersion } **\n\n`
622
+
623
+ // Use consistent version formatting with constraints
624
+ const versionChange = this . formatVersionChange ( update . currentVersion , update . newVersion )
625
+ . replace ( / ` / g, '' ) // Remove backticks for clean display in details
626
+ body += `**${ versionChange } **\n\n`
623
627
624
628
// Add file reference with link to the dependency file
625
629
if ( update . file ) {
@@ -651,7 +655,12 @@ export class PullRequestGenerator {
651
655
for ( const update of uniqueComposerUpdates ) {
652
656
body += `<details>\n`
653
657
body += `<summary>${ update . name } </summary>\n\n`
654
- body += `**${ update . currentVersion } -> ${ update . newVersion } **\n\n`
658
+
659
+ // Use consistent version formatting with constraints
660
+ const versionChange = this . formatVersionChange ( update . currentVersion , update . newVersion )
661
+ . replace ( / ` / g, '' ) // Remove backticks for clean display in details
662
+ body += `**${ versionChange } **\n\n`
663
+
655
664
body += `Visit [${ update . name } ](https://packagist.org/packages/${ encodeURIComponent ( update . name ) } ) on Packagist for more information.\n\n`
656
665
body += `</details>\n\n`
657
666
}
@@ -660,7 +669,12 @@ export class PullRequestGenerator {
660
669
for ( const update of uniqueGithubActionsUpdates ) {
661
670
body += `<details>\n`
662
671
body += `<summary>${ update . name } </summary>\n\n`
663
- body += `**${ update . currentVersion } -> ${ update . newVersion } **\n\n`
672
+
673
+ // Use consistent version formatting with constraints
674
+ const versionChange = this . formatVersionChange ( update . currentVersion , update . newVersion )
675
+ . replace ( / ` / g, '' ) // Remove backticks for clean display in details
676
+ body += `**${ versionChange } **\n\n`
677
+
664
678
body += `Visit [${ update . name } ](https://github.com/${ update . name } /releases) for release notes.\n\n`
665
679
body += `</details>\n\n`
666
680
}
@@ -982,6 +996,25 @@ export class PullRequestGenerator {
982
996
return 'patch'
983
997
}
984
998
999
+ /**
1000
+ * Format version change preserving constraint prefixes
1001
+ */
1002
+ private formatVersionChange ( currentVersion : string , newVersion : string ) : string {
1003
+ // Check if current version has constraint prefix (^, ~, >=, etc.)
1004
+ const constraintMatch = currentVersion . match ( / ^ ( [ ^ 0 - 9 ] + ) / )
1005
+ const constraintPrefix = constraintMatch ? constraintMatch [ 1 ] : ''
1006
+
1007
+ // If there's a constraint prefix, preserve it in the new version display
1008
+ if ( constraintPrefix ) {
1009
+ const cleanCurrent = currentVersion . replace ( / ^ [ ^ 0 - 9 ] + / , '' )
1010
+ const cleanNew = newVersion . replace ( / ^ [ ^ 0 - 9 ] + / , '' )
1011
+ return `\`${ constraintPrefix } ${ cleanCurrent } \` → \`${ constraintPrefix } ${ cleanNew } \``
1012
+ }
1013
+
1014
+ // No constraint prefix, display as-is
1015
+ return `\`${ currentVersion } \` → \`${ newVersion } \``
1016
+ }
1017
+
985
1018
/**
986
1019
* Generate a description of the version change
987
1020
*/
0 commit comments