Skip to content

Commit efdc4a7

Browse files
committed
Remove debug and fix glob
1 parent 0899e1f commit efdc4a7

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/commands/fix/pnpm-fix.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ export async function pnpmFix(
320320
),
321321
)
322322
}
323-
console.log(infos)
323+
324324
if (!infos.length) {
325-
//continue infoEntriesLoop
325+
continue infoEntriesLoop
326326
}
327327

328328
logger.log(`Processing vulns for ${name}:`)

src/utils/fs.mts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { promises as fs, readFileSync as fsReadFileSync } from 'node:fs'
22
import path from 'node:path'
33

44
import { remove } from '@socketsecurity/registry/lib/fs'
5+
import { pEach } from '@socketsecurity/registry/lib/promises'
56

67
import constants from '../constants.mts'
78
import { globNodeModules } from './glob.mts'
@@ -20,8 +21,11 @@ const { abortSignal } = constants
2021

2122
export async function removeNodeModules(cwd = process.cwd()) {
2223
const nodeModulesPaths = await globNodeModules(cwd)
23-
await Promise.all(
24-
nodeModulesPaths.map(p => remove(p, { force: true, recursive: true })),
24+
await pEach(
25+
nodeModulesPaths,
26+
3,
27+
p => remove(p, { force: true, recursive: true }),
28+
{ retries: 3 },
2529
)
2630
}
2731

src/utils/glob.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ export async function globWithGitIgnore(
247247
export async function globNodeModules(cwd = process.cwd()): Promise<string[]> {
248248
return await tinyGlob('**/node_modules', {
249249
absolute: true,
250-
onlyDirectories: true,
251250
cwd,
251+
expandDirectories: false,
252+
onlyDirectories: true,
252253
})
253254
}
254255

0 commit comments

Comments
 (0)