Skip to content

Commit e394c7f

Browse files
committed
Add support for finding .socket.facts.json
1 parent a07b7d0 commit e394c7f

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

src/utils/glob.mts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type { SocketYml } from '@socketsecurity/config'
1616
import type { SocketSdkReturnType } from '@socketsecurity/sdk'
1717
import type { GlobOptions } from 'tinyglobby'
1818

19-
const { NPM, PNPM } = constants
19+
const { PNPM } = constants
2020

2121
const PNPM_WORKSPACE = `${PNPM}-workspace`
2222

@@ -166,18 +166,13 @@ export async function filterGlobResultToSupportedFiles(
166166
entries: string[] | readonly string[],
167167
supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'],
168168
): Promise<string[]> {
169-
const patterns = ['golang', NPM, 'maven', 'pypi', 'gem', 'nuget'].reduce(
170-
(r: string[], n: string) => {
171-
const supported = supportedFiles[n]
172-
r.push(
173-
...(supported
174-
? Object.values(supported).map(p => `**/${p.pattern}`)
175-
: []),
176-
)
177-
return r
178-
},
179-
[],
180-
)
169+
const patterns: string[] = []
170+
for (const key of Object.keys(supportedFiles)) {
171+
const supported = supportedFiles[key]
172+
if (supported) {
173+
patterns.push(...Object.values(supported).map(p => `**/${p.pattern}`))
174+
}
175+
}
181176
return entries.filter(p => micromatch.some(p, patterns))
182177
}
183178

@@ -225,6 +220,7 @@ export async function globWithGitIgnore(
225220
const globOptions = {
226221
absolute: true,
227222
cwd,
223+
dot: true,
228224
expandDirectories: false,
229225
ignore: hasNegatedPattern ? [] : ignores,
230226
...additionalOptions,

src/utils/path-resolve.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'node:path'
33

44
import which from 'which'
55

6-
import { debugFn, isDebug } from '@socketsecurity/registry/lib/debug'
6+
import { debugDir, debugFn, isDebug } from '@socketsecurity/registry/lib/debug'
77
import { resolveBinPathSync } from '@socketsecurity/registry/lib/npm'
88
import { pluralize } from '@socketsecurity/registry/lib/words'
99

@@ -138,7 +138,7 @@ export async function getPackageFilesForScan(
138138
`Found ${packageFiles.length} local ${pluralize('file', packageFiles.length)}`,
139139
)
140140

141-
debugFn('inspect', 'paths: absolute', packageFiles)
141+
debugDir('inspect', { packageFiles })
142142

143143
return packageFiles
144144
}

0 commit comments

Comments
 (0)