From 4af79de39604ece990003d69eccb9edc431d00ee Mon Sep 17 00:00:00 2001 From: Peter van der Zee Date: Thu, 3 Apr 2025 12:01:07 +0200 Subject: [PATCH] Remove yaml config from some paths --- src/utils/path-resolve.ts | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/utils/path-resolve.ts b/src/utils/path-resolve.ts index a55cbf903..ef4a81cbb 100644 --- a/src/utils/path-resolve.ts +++ b/src/utils/path-resolve.ts @@ -13,14 +13,9 @@ import { resolveBinPath } from '@socketsecurity/registry/lib/npm' import { directoryPatterns } from './ignore-by-default' import constants from '../constants' -import type { SocketYml } from '@socketsecurity/config' import type { SocketSdkReturnType } from '@socketsecurity/sdk' import type { GlobOptions } from 'tinyglobby' -type GlobWithGitIgnoreOptions = GlobOptions & { - socketConfig?: SocketYml | undefined -} - const { NODE_MODULES, NPM, shadowBinPath } = constants async function filterGlobResultToSupportedFiles( @@ -42,16 +37,8 @@ async function filterGlobResultToSupportedFiles( return entries.filter(p => micromatch.some(p, patterns)) } -async function globWithGitIgnore( - patterns: string[], - options: GlobWithGitIgnoreOptions -) { - const { - cwd = process.cwd(), - socketConfig, - ...additionalOptions - } = { __proto__: null, ...options } as GlobWithGitIgnoreOptions - const projectIgnorePaths = socketConfig?.projectIgnorePaths +async function globWithGitIgnore(patterns: string[], options: GlobOptions) { + const { cwd = process.cwd(), ...additionalOptions } = options const ignoreFiles = await tinyGlob(['**/.gitignore'], { absolute: true, cwd, @@ -59,13 +46,6 @@ async function globWithGitIgnore( }) const ignores = [ ...directoryPatterns(), - ...(Array.isArray(projectIgnorePaths) - ? ignoreFileLinesToGlobPatterns( - projectIgnorePaths, - path.join(cwd, '.gitignore'), - cwd - ) - : []), ...( await Promise.all( ignoreFiles.map(async filepath => @@ -251,14 +231,12 @@ export function findNpmPathSync(npmBinPath: string): string | undefined { export async function getPackageFilesForScan( cwd: string, inputPaths: string[], - supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'], - config?: SocketYml | undefined + supportedFiles: SocketSdkReturnType<'getReportSupportedFiles'>['data'] ): Promise { debugLog(`Globbed resolving ${inputPaths.length} paths:`, inputPaths) const entries = await globWithGitIgnore(pathsToPatterns(inputPaths), { - cwd, - socketConfig: config + cwd }) debugLog(