Skip to content

Commit e76e7ff

Browse files
committed
Add default fix limit of 10
1 parent 7921d18 commit e76e7ff

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/commands/fix/cmd-fix.mts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import type { RangeStyle } from '../../utils/semver.mts'
2222

2323
const { DRY_RUN_NOT_SAVING } = constants
2424

25+
const DEFAULT_LIMIT = 10
26+
2527
const config: CliCommandConfig = {
2628
commandName: 'fix',
2729
description: 'Update dependencies with "fixable" Socket alerts',
@@ -53,8 +55,8 @@ const config: CliCommandConfig = {
5355
},
5456
limit: {
5557
type: 'number',
56-
default: Infinity,
57-
description: 'The number of fixes to attempt at a time',
58+
default: DEFAULT_LIMIT,
59+
description: `The number of fixes to attempt at a time (default ${DEFAULT_LIMIT})`,
5860
},
5961
maxSatisfying: {
6062
type: 'boolean',
@@ -88,7 +90,7 @@ const config: CliCommandConfig = {
8890
type: 'string',
8991
default: 'preserve',
9092
description: `
91-
Define how updated dependency versions should be written in package.json.
93+
Define how dependency version ranges are updated in package.json (default 'preserve').
9294
Available styles:
9395
* caret - Use ^ range for compatible updates (e.g. ^1.2.3)
9496
* gt - Use > to allow any newer version (e.g. >1.2.3)
@@ -108,7 +110,7 @@ const config: CliCommandConfig = {
108110
testScript: {
109111
type: 'string',
110112
default: 'test',
111-
description: 'The test script to run for each fix attempt',
113+
description: 'The test script to run for each fix attempt (default \'test\')',
112114
},
113115
},
114116
help: (command, config) => `
@@ -214,10 +216,7 @@ async function run(
214216
const unknownFlags = cli.unknownFlags ?? []
215217

216218
const ghsas = cmdFlagValueToArray(cli.flags['ghsa'])
217-
const limit =
218-
(cli.flags['limit']
219-
? parseInt(String(cli.flags['limit'] || ''), 10)
220-
: Infinity) || Infinity
219+
const limit = Number(cli.flags['limit']) || DEFAULT_LIMIT
221220
const maxSatisfying = Boolean(cli.flags['maxSatisfying'])
222221
const minSatisfying = Boolean(cli.flags['minSatisfying']) || !maxSatisfying
223222
const prCheck = Boolean(cli.flags['prCheck'])

0 commit comments

Comments
 (0)