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/commands/diff-scan/get-diff-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export async function getDiffScan(

if (!response.ok) {
const err = await handleAPIError(response.status)
spinner.error(`${colors.bgRed(colors.white(response.statusText))}: ${err}`)
spinner.errorAndStop(
`${colors.bgRed(colors.white(response.statusText))}: ${err}`
)
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/fix/run-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export async function runFix() {
// eslint-disable-next-line no-await-in-loop
await editablePkgJson.save()
} catch {
spinner.error(`Reverting ${name} to ${oldVersion}`)
spinner.errorAndStop(`Reverting ${name} to ${oldVersion}`)
spinner.start()
arb.idealTree = revertToIdealTree
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/format-package-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function formatPackageInfo(
)
formatPackageIssuesDetails(data, outputMarkdown)
} else {
spinner.success('Package has no issues')
spinner.successAndStop('Package has no issues')
}

const format = new ColorOrMarkdown(!!outputMarkdown)
Expand Down
6 changes: 3 additions & 3 deletions src/commands/login/attempt-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function attemptLogin(
orgs = result.data
spinner.success('API key verified')
} catch {
spinner.error('Invalid API key')
spinner.errorAndStop('Invalid API key')
return
}

Expand Down Expand Up @@ -97,8 +97,8 @@ export async function attemptLogin(
const oldToken = getSetting('apiToken')
try {
applyLogin(apiToken, enforcedOrgs, apiBaseUrl, apiProxy)
spinner.success(`API credentials ${oldToken ? 'updated' : 'set'}`)
spinner.successAndStop(`API credentials ${oldToken ? 'updated' : 'set'}`)
} catch {
spinner.error(`API login failed`)
spinner.errorAndStop(`API login failed`)
}
}
13 changes: 8 additions & 5 deletions src/commands/manifest/convert_gradle_to_maven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ export async function convertGradleToMaven(
const output = await spawn(bin, commandArgs, {
cwd: target || '.'
})
spinner.success()
spinner.stop()
if (verbose) {
console.group('[VERBOSE] gradle stdout:')
console.log(output)
console.groupEnd()
}

if (output.stderr) {
spinner.error('There were errors while running gradle')
spinner.errorAndStop('There were errors while running gradle')
// (In verbose mode, stderr was printed above, no need to repeat it)
if (!verbose) {
console.group('[VERBOSE] stderr:')
Expand All @@ -71,6 +71,9 @@ export async function convertGradleToMaven(
process.exit(1)
}

spinner.start()
spinner.successAndStop('Executed gradle successfully')

console.log('Reported exports:')
output.stdout.replace(
/^POM file copied to: (.*)/gm,
Expand All @@ -82,7 +85,7 @@ export async function convertGradleToMaven(

// const loc = output.stdout?.match(/Wrote (.*?.pom)\n/)?.[1]?.trim()
// if (!loc) {
// spinner.error(
// spinner.errorAndStop(
// 'There were no errors from sbt but could not find the location of resulting .pom file either'
// )
// process.exit(1)
Expand All @@ -104,11 +107,11 @@ export async function convertGradleToMaven(
// }
// // TODO: do we prefer fs-extra? renaming can be gnarly on windows and fs-extra's version is better
// await renamep(loc, out)
// spinner.success()
// spinner.successAndStop()
// spinner.start().success(`OK. File should be available in \`${out}\``)
// }
} catch (e) {
spinner.error(
spinner.errorAndStop(
'There was an unexpected error while running this' +
(verbose ? '' : ' (use --verbose for details)')
)
Expand Down
9 changes: 5 additions & 4 deletions src/commands/manifest/convert_sbt_to_maven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ export async function convertSbtToMaven(
const output = await spawn(bin, ['makePom'].concat(sbtOpts), {
cwd: target || '.'
})
spinner.success()
spinner.successAndStop()
if (verbose) {
console.group('[VERBOSE] sbt stdout:')
console.log(output)
console.groupEnd()
}

if (output.stderr) {
spinner.error('There were errors while running sbt')
spinner.start()
spinner.errorAndStop('There were errors while running sbt')
// (In verbose mode, stderr was printed above, no need to repeat it)
if (!verbose) {
console.group('[VERBOSE] stderr:')
Expand All @@ -68,7 +69,7 @@ export async function convertSbtToMaven(
})

if (!poms.length) {
spinner.error(
spinner.errorAndStop(
'There were no errors from sbt but it seems to not have generated any poms either'
)
process.exit(1)
Expand Down Expand Up @@ -106,7 +107,7 @@ export async function convertSbtToMaven(
spinner.start().success(`OK`)
}
} catch (e) {
spinner.error(
spinner.errorAndStop(
'There was an unexpected error while running this' +
(verbose ? '' : ' (use --verbose for details)')
)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/report/create-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function createReport(
handleUnsuccessfulApiResponse('createReport', result, spinner)
return undefined
}
spinner.success()
spinner.successAndStop()
return result
}
}
8 changes: 4 additions & 4 deletions src/commands/report/fetch-report-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,19 @@ export async function fetchReportData(

if (strict) {
if (result.data.healthy) {
spinner.success('Report result is healthy and great!')
spinner.successAndStop('Report result is healthy and great!')
} else {
spinner.error('Report result deemed unhealthy for project')
spinner.errorAndStop('Report result deemed unhealthy for project')
}
} else if (!result.data.healthy) {
const severityCount = getSeverityCount(
result.data.issues,
includeAllIssues ? undefined : 'high'
)
const issueSummary = formatSeverityCount(severityCount)
spinner.success(`Report has these issues: ${issueSummary}`)
spinner.successAndStop(`Report has these issues: ${issueSummary}`)
} else {
spinner.success('Report has no issues')
spinner.successAndStop('Report has no issues')
}

return result.data
Expand Down
2 changes: 1 addition & 1 deletion src/commands/repos/create-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function createRepo({
)

if (result.success) {
spinner.success('Repository created successfully')
spinner.successAndStop('Repository created successfully')
} else {
handleUnsuccessfulApiResponse('createOrgRepo', result, spinner)
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/repos/delete-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function deleteRepo(
)

if (result.success) {
spinner.success('Repository deleted successfully')
spinner.successAndStop('Repository deleted successfully')
} else {
handleUnsuccessfulApiResponse('deleteOrgRepo', result, spinner)
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/repos/update-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function updateRepo({
)

if (result.success) {
spinner.success('Repository updated successfully')
spinner.successAndStop('Repository updated successfully')
} else {
handleUnsuccessfulApiResponse('updateOrgRepo', result, spinner)
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/scan/delete-full-scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function deleteOrgFullScan(
)

if (result.success) {
spinner.success('Scan deleted successfully')
spinner.successAndStop('Scan deleted successfully')
} else {
handleUnsuccessfulApiResponse('deleteOrgFullScan', result, spinner)
}
Expand Down
Loading