@@ -202,8 +202,7 @@ export async function pnpmFix(
202202 )
203203 } catch ( e ) {
204204 spinner ?. stop ( )
205- debugFn ( 'Unexpected Socket batch PURL API error:' )
206- debugFn ( e )
205+ debugFn ( 'fail: PURL API\n' , e )
207206 return {
208207 ok : false ,
209208 message : 'API Error' ,
@@ -236,6 +235,9 @@ export async function pnpmFix(
236235 // Process the workspace root last since it will add an override to package.json.
237236 pkgEnvDetails . editablePkgJson . filename ! ,
238237 ]
238+ const sortedInfoEntries = [ ...infoByPkgName . entries ( ) ] . sort ( ( a , b ) =>
239+ naturalCompare ( a [ 0 ] , b [ 0 ] ) ,
240+ )
239241
240242 const handleInstallFail = ( ) : CResult < { fixed : boolean } > => {
241243 logger . dedent ( )
@@ -252,9 +254,6 @@ export async function pnpmFix(
252254
253255 let count = 0
254256
255- const sortedInfoEntries = [ ...infoByPkgName . entries ( ) ] . sort ( ( a , b ) =>
256- naturalCompare ( a [ 0 ] , b [ 0 ] ) ,
257- )
258257 infoEntriesLoop: for (
259258 let i = 0 , { length } = sortedInfoEntries ;
260259 i < length ;
@@ -268,7 +267,7 @@ export async function pnpmFix(
268267 spinner ?. indent ( )
269268
270269 if ( getManifestData ( NPM , name ) ) {
271- debugFn ( `Socket Optimize package exists for ${ name } . ` )
270+ debugFn ( `found: Socket Optimize variant for ${ name } ` )
272271 }
273272 // eslint-disable-next-line no-await-in-loop
274273 const packument = await fetchPackagePackument ( name )
@@ -326,7 +325,7 @@ export async function pnpmFix(
326325 )
327326
328327 if ( ! oldVersions . length ) {
329- debugFn ( `${ name } not found, skipping. \n` )
328+ debugFn ( `skip: ${ name } not found\n` )
330329 // Skip to next package.
331330 logger . dedent ( )
332331 spinner ?. dedent ( )
@@ -351,7 +350,7 @@ export async function pnpmFix(
351350 let hasAnnouncedWorkspace = false
352351 let workspaceLogCallCount = logger . logCallCount
353352 if ( isDebug ( ) ) {
354- debugFn ( `Checking workspace ${ workspace } . ` )
353+ debugFn ( `check: workspace ${ workspace } ` )
355354 hasAnnouncedWorkspace = true
356355 workspaceLogCallCount = logger . logCallCount
357356 }
@@ -362,17 +361,15 @@ export async function pnpmFix(
362361
363362 const node = findPackageNode ( actualTree , name , oldVersion )
364363 if ( ! node ) {
365- debugFn ( `${ oldId } not found, skipping. ` )
364+ debugFn ( `skip: ${ oldId } not found` )
366365 continue oldVersionsLoop
367366 }
368367 infosLoop: for ( const {
369368 firstPatchedVersionIdentifier,
370369 vulnerableVersionRange,
371370 } of infos . values ( ) ) {
372371 if ( semver . gte ( oldVersion , firstPatchedVersionIdentifier ) ) {
373- debugFn (
374- `${ oldId } is >= ${ firstPatchedVersionIdentifier } , skipping.` ,
375- )
372+ debugFn ( `skip: ${ oldId } is >= ${ firstPatchedVersionIdentifier } ` )
376373 continue infosLoop
377374 }
378375 const newVersion = findBestPatchVersion (
@@ -460,7 +457,7 @@ export async function pnpmFix(
460457 )
461458 // eslint-disable-next-line no-await-in-loop
462459 if ( ! ( await editablePkgJson . save ( { ignoreWhitespace : true } ) ) ) {
463- debugFn ( `${ workspace } /package.json unchanged, skipping. ` )
460+ debugFn ( `skip: ${ workspace } /package.json unchanged` )
464461 // Reset things just in case.
465462 if ( isCi ) {
466463 // eslint-disable-next-line no-await-in-loop
@@ -556,14 +553,12 @@ export async function pnpmFix(
556553 await prExistForBranch ( repoInfo . owner , repoInfo . repo , branch )
557554 ) {
558555 skipPr = true
559- debugFn ( `Branch "${ branch } " exists, skipping PR creation. ` )
556+ debugFn ( `skip: branch "${ branch } " exists` )
560557 }
561558 // eslint-disable-next-line no-await-in-loop
562559 else if ( await gitRemoteBranchExists ( branch , cwd ) ) {
563560 skipPr = true
564- debugFn (
565- `Remote branch "${ branch } " exists, skipping PR creation.` ,
566- )
561+ debugFn ( `skip: remote branch "${ branch } " exists` )
567562 } else if (
568563 // eslint-disable-next-line no-await-in-loop
569564 ! ( await gitCreateAndPushBranch (
@@ -734,5 +729,6 @@ export async function pnpmFix(
734729
735730 spinner ?. stop ( )
736731
737- return { ok : true , data : { fixed : true } } // or, did we change anything?
732+ // Or, did we change anything?
733+ return { ok : true , data : { fixed : true } }
738734}
0 commit comments