File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { readFileSync } from 'node:fs'
2-
1+ import { readJsonSync } from '@socketsecurity/registry/lib/fs'
32import { spawn } from '@socketsecurity/registry/lib/spawn'
43
54import { getDefaultOrgSlug } from '../commands/ci/fetch-default-org-slug.mts'
@@ -65,11 +64,9 @@ export async function spawnCoana(
6564export function extractTier1ReachabilityScanId (
6665 socketFactsFile : string ,
6766) : string | undefined {
68- try {
69- const content = readFileSync ( socketFactsFile , 'utf8' )
70- const json = JSON . parse ( content )
71- return json . tier1ReachabilityScanId
72- } catch {
73- return undefined
74- }
67+ const json = readJsonSync ( socketFactsFile , { throws : false } )
68+ const tier1ReachabilityScanId = json ?. [ 'tier1ReachabilityScanId' ]
69+ return typeof tier1ReachabilityScanId === 'string' && tier1ReachabilityScanId . length > 0
70+ ? tier1ReachabilityScanId
71+ : undefined
7572}
You can’t perform that action at this time.
0 commit comments