Skip to content

Commit daa40c8

Browse files
committed
Support ./ for scan create too
1 parent e376d50 commit daa40c8

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

src/cli.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { pathToFileURL } from 'node:url'
66
import { messageWithCauses, stackWithCauses } from 'pony-cause'
77
import updateNotifier from 'tiny-updater'
88

9+
import { debugLog } from '@socketsecurity/registry/lib/debug'
910
import { logger } from '@socketsecurity/registry/lib/logger'
1011

1112
import { cmdAnalytics } from './commands/analytics/cmd-analytics'
@@ -107,9 +108,10 @@ void (async () => {
107108
} else {
108109
errorTitle = 'Unexpected error with no details'
109110
}
111+
logger.error('\n') // Any-spinner-newline
110112
logger.fail(failMsgWithBadge(errorTitle, errorMessage))
111113
if (errorBody) {
112-
logger.error(`\n${errorBody}`)
114+
debugLog(`${errorBody}`)
113115
}
114116
await captureException(e)
115117
}

src/commands/scan/cmd-scan-create.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,24 +161,28 @@ async function run(
161161
})
162162

163163
const {
164+
branch: branchName = '',
164165
cwd: cwdOverride,
165166
defaultBranch,
166167
dryRun,
167168
json,
168169
markdown,
169170
pendingHead,
170171
readOnly,
172+
repo: repoName = '',
171173
report,
172174
tmp
173175
} = cli.flags as {
176+
branch: string
174177
cwd: string
178+
defaultBranch: boolean
175179
dryRun: boolean
176-
report: boolean
177180
json: boolean
178181
markdown: boolean
179-
defaultBranch: boolean
180182
pendingHead: boolean
181183
readOnly: boolean
184+
repo: string
185+
report: boolean
182186
tmp: boolean
183187
}
184188
const defaultOrgSlug = getConfigValue('defaultOrg')
@@ -189,10 +193,6 @@ async function run(
189193
cwdOverride && cwdOverride !== 'process.cwd()'
190194
? String(cwdOverride)
191195
: process.cwd()
192-
const { branch: branchName = '', repo: repoName = '' } = cli.flags as {
193-
branch: string
194-
repo: string
195-
}
196196

197197
// We're going to need an api token to suggest data because those suggestions
198198
// must come from data we already know. Don't error on missing api token yet.

src/utils/path-resolve.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function ignorePatternToMinimatch(pattern: string): string {
172172

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

178178
export function findBinPathDetailsSync(binName: string): {
@@ -262,9 +262,11 @@ export async function getPackageFilesForScan(
262262
// Lazily access constants.spinner.
263263
const { spinner } = constants
264264

265+
const pats = pathsToPatterns(inputPaths)
266+
265267
spinner.start('Searching for local files to include in scan...')
266268

267-
const entries = await globWithGitIgnore(pathsToPatterns(inputPaths), {
269+
const entries = await globWithGitIgnore(pats, {
268270
cwd,
269271
socketConfig: config
270272
})

0 commit comments

Comments
 (0)