Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { pathToFileURL } from 'node:url'
import { messageWithCauses, stackWithCauses } from 'pony-cause'
import updateNotifier from 'tiny-updater'

import { debugLog } from '@socketsecurity/registry/lib/debug'
import { logger } from '@socketsecurity/registry/lib/logger'

import { cmdAnalytics } from './commands/analytics/cmd-analytics'
Expand Down Expand Up @@ -107,9 +108,10 @@ void (async () => {
} else {
errorTitle = 'Unexpected error with no details'
}
logger.error('\n') // Any-spinner-newline
logger.fail(failMsgWithBadge(errorTitle, errorMessage))
if (errorBody) {
logger.error(`\n${errorBody}`)
debugLog(`${errorBody}`)
}
await captureException(e)
}
Expand Down
12 changes: 6 additions & 6 deletions src/commands/scan/cmd-scan-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,28 @@ async function run(
})

const {
branch: branchName = '',
cwd: cwdOverride,
defaultBranch,
dryRun,
json,
markdown,
pendingHead,
readOnly,
repo: repoName = '',
report,
tmp
} = cli.flags as {
branch: string
cwd: string
defaultBranch: boolean
dryRun: boolean
report: boolean
json: boolean
markdown: boolean
defaultBranch: boolean
pendingHead: boolean
readOnly: boolean
repo: string
report: boolean
tmp: boolean
}
const defaultOrgSlug = getConfigValue('defaultOrg')
Expand All @@ -189,10 +193,6 @@ async function run(
cwdOverride && cwdOverride !== 'process.cwd()'
? String(cwdOverride)
: process.cwd()
const { branch: branchName = '', repo: repoName = '' } = cli.flags as {
branch: string
repo: string
}

// We're going to need an api token to suggest data because those suggestions
// must come from data we already know. Don't error on missing api token yet.
Expand Down
6 changes: 4 additions & 2 deletions src/utils/path-resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function ignorePatternToMinimatch(pattern: string): string {

function pathsToPatterns(paths: string[] | readonly string[]): string[] {
// TODO: Does not support `~/` paths.
return paths.map(p => (p === '.' ? '**/*' : p))
return paths.map(p => (p === '.' || p === './' ? '**/*' : p))
}

export function findBinPathDetailsSync(binName: string): {
Expand Down Expand Up @@ -262,9 +262,11 @@ export async function getPackageFilesForScan(
// Lazily access constants.spinner.
const { spinner } = constants

const pats = pathsToPatterns(inputPaths)

spinner.start('Searching for local files to include in scan...')

const entries = await globWithGitIgnore(pathsToPatterns(inputPaths), {
const entries = await globWithGitIgnore(pats, {
cwd,
socketConfig: config
})
Expand Down