@@ -26,7 +26,7 @@ import {
2626 getGitHubEnvRepoInfo ,
2727 openGitHubPullRequest
2828} from './open-pr.mts'
29- import { alertMapOptions } from './shared.mts'
29+ import { getAlertMapOptions } from './shared.mts'
3030import constants from '../../constants.mts'
3131import {
3232 SAFE_ARBORIST_REIFY_OPTIONS_OVERRIDES ,
@@ -97,6 +97,7 @@ export async function pnpmFix(
9797 autoMerge,
9898 cwd,
9999 dryRun,
100+ limit,
100101 purls,
101102 rangeStyle,
102103 test,
@@ -126,10 +127,14 @@ export async function pnpmFix(
126127 }
127128
128129 const alertsMap = purls . length
129- ? await getAlertsMapFromPurls ( purls , alertMapOptions )
130- : await getAlertsMapFromPnpmLockfile ( lockfile , alertMapOptions )
130+ ? await getAlertsMapFromPurls ( purls , getAlertMapOptions ( { limit } ) )
131+ : await getAlertsMapFromPnpmLockfile (
132+ lockfile ,
133+ getAlertMapOptions ( { limit } )
134+ )
131135
132- const infoByPkg = getCveInfoByAlertsMap ( alertsMap )
136+ const infoByPkg = getCveInfoByAlertsMap ( alertsMap , { limit } )
137+ console . log ( infoByPkg )
133138 if ( ! infoByPkg ) {
134139 spinner ?. stop ( )
135140 logger . info ( 'No fixable vulnerabilities found.' )
@@ -148,7 +153,8 @@ export async function pnpmFix(
148153 pkgEnvDetails . editablePkgJson . filename !
149154 ]
150155
151- for ( const { 0 : name , 1 : infos } of infoByPkg ) {
156+ let count = 0
157+ infoByPkgLoop: for ( const { 0 : name , 1 : infos } of infoByPkg ) {
152158 debugLog ( `Processing vulnerable package: ${ name } ` )
153159
154160 if ( getManifestData ( NPM , name ) ) {
@@ -397,6 +403,9 @@ export async function pnpmFix(
397403 error
398404 )
399405 }
406+ if ( ++ count >= limit ) {
407+ break infoByPkgLoop
408+ }
400409 }
401410 }
402411 }
0 commit comments