@@ -2,6 +2,7 @@ import chalk from 'chalk';
22import  {  spawn  }  from  'child_process' ; 
33import  {  existsSync  }  from  'fs' ; 
44import  {  join  }  from  'path' ; 
5+ import  {  pluralize  }  from  '../utils/pluralize' ; 
56
67export  type  PackageManager  =  'npm'  |  'pnpm'  |  'yarn'  |  'bun' ; 
78
@@ -107,20 +108,66 @@ export function runPackageManagerCommand(
107108 * @returns  Promise that resolves when all updates are complete 
108109 */ 
109110export  async  function  updateDependencies ( 
110-   dependencies : Array < {  packageName : string ;  latestVersion : string  } > , 
111+   dependencies : Array < { 
112+     packageName : string ; 
113+     currentVersion : string ; 
114+     latestVersion : string ; 
115+     updateType : 'patch'  |  'minor'  |  'major' ; 
116+     category : string ; 
117+   } > , 
111118  packageManager : PackageManagerInfo 
112119) : Promise < void >  { 
113120  if  ( dependencies . length  ===  0 )  { 
114121    console . log ( chalk . yellow ( 'No dependencies to update' ) ) ; 
115122    return ; 
116123  } 
117124
125+   const  dependencyWord  =  pluralize ( 
126+     dependencies . length , 
127+     'dependency' , 
128+     'dependencies' 
129+   ) ; 
130+ 
118131  console . log ( 
119132    chalk . cyan ( 
120-       `\n🔄 Updating ${ dependencies . length } dependencies  using ${ packageManager . name }  
133+       `\n🔄 Updating ${ dependencies . length } ${ dependencyWord } ${ packageManager . name }  
121134    ) 
122135  ) ; 
123136
137+   // Group dependencies by category 
138+   const  groupedDeps  =  dependencies . reduce ( 
139+     ( groups ,  dep )  =>  { 
140+       const  category  =  dep . category  ||  'Dependencies' ; 
141+       if  ( ! groups [ category ] )  { 
142+         groups [ category ]  =  [ ] ; 
143+       } 
144+       groups [ category ] . push ( dep ) ; 
145+       return  groups ; 
146+     } , 
147+     { }  as  Record < string ,  typeof  dependencies > 
148+   ) ; 
149+ 
150+   // Show version changes for each dependency grouped by category 
151+   for  ( const  [ category ,  deps ]  of  Object . entries ( groupedDeps ) )  { 
152+     if  ( deps . length  >  0 )  { 
153+       console . log ( chalk . gray ( `${ category }  ) ) ; 
154+ 
155+       for  ( const  dep  of  deps )  { 
156+         const  updateTypeColor  =  { 
157+           major : chalk . yellow , 
158+           minor : chalk . magenta , 
159+           patch : chalk . blue , 
160+         } [ dep . updateType ] ; 
161+         const  updateTypeLabel  =  updateTypeColor ( `[${ dep . updateType }  ) ; 
162+         console . log ( 
163+           chalk . gray ( 
164+             `   ${ dep . packageName } ${ dep . currentVersion } ${ dep . latestVersion } ${ updateTypeLabel }  
165+           ) 
166+         ) ; 
167+       } 
168+     } 
169+   } 
170+ 
124171  try  { 
125172    // Build the arguments array for the package manager 
126173    const  args : string [ ]  =  [ ] ; 
@@ -147,7 +194,7 @@ export async function updateDependencies(
147194
148195    console . log ( 
149196      chalk . green ( 
150-         `\n✅ Successfully updated ${ dependencies . length } dependencies !` 
197+         `\n✅ Successfully updated ${ dependencies . length } ${ dependencyWord }  
151198      ) 
152199    ) ; 
153200  }  catch  ( error )  { 
0 commit comments