Skip to content

Commit db90e7a

Browse files
committed
Remove try-to-fix prompt
1 parent b4c547e commit db90e7a

File tree

1 file changed

+7
-22
lines changed
  • src/shadow/arborist/lib/arborist

1 file changed

+7
-22
lines changed

src/shadow/arborist/lib/arborist/reify.ts

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -365,26 +365,25 @@ export async function reify(
365365
...args: Parameters<InstanceType<ArboristClass>['reify']>
366366
): Promise<SafeNode> {
367367
const IPC = await getIPC()
368+
const runningFixCommand = !!IPC[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]
368369
// We are assuming `this[_diffTrees]()` has been called by `super.reify(...)`:
369370
// https://github.com/npm/cli/blob/v11.0.0/workspaces/arborist/lib/arborist/reify.js#L141
370371
let needInfoOn = getPackagesToQueryFromDiff(this.diff, {
371-
includeUnchanged: !!IPC[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]
372+
includeUnchanged: runningFixCommand
372373
})
373374
if (!needInfoOn.length) {
374375
// Nothing to check, hmmm already installed or all private?
375376
return await this[kRiskyReify](...args)
376377
}
377-
const {
378-
[SOCKET_CLI_FIX_PACKAGE_LOCK_FILE]: bypassConfirms,
379-
[SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE]: bypassAlerts
380-
} = IPC
378+
const runningOptimizeCommand =
379+
!!IPC[SOCKET_CLI_UPDATE_OVERRIDES_IN_PACKAGE_LOCK_FILE]
381380
const { stderr: output, stdin: input } = process
382-
let alerts: SocketPackageAlert[] = bypassAlerts
381+
let alerts: SocketPackageAlert[] = runningOptimizeCommand
383382
? []
384383
: await getPackagesAlerts(needInfoOn, { output })
385384
if (
386385
alerts.length &&
387-
!bypassConfirms &&
386+
!runningFixCommand &&
388387
!(await confirm(
389388
{
390389
message: 'Accept risks of installing these packages?',
@@ -399,21 +398,7 @@ export async function reify(
399398
) {
400399
throw new Error('Socket npm exiting due to risks')
401400
}
402-
if (
403-
!alerts.length ||
404-
(!bypassConfirms &&
405-
!(await confirm(
406-
{
407-
message: 'Try to fix alerts?',
408-
default: true
409-
},
410-
{
411-
input,
412-
output,
413-
signal: abortSignal
414-
}
415-
)))
416-
) {
401+
if (!alerts.length || !runningFixCommand) {
417402
return await this[kRiskyReify](...args)
418403
}
419404
const prev = new Set(alerts.map(a => a.key))

0 commit comments

Comments
 (0)